Let's start by building a simple static website in your local environment.
Install the latest recommended version of Node.js.
Create Your First Project
npm to create a project.
npm init lwr
- For Project name, enter StaticSite.
- Accept the generated package name by pressing the Enter key.
- For Select a type of project, accept the default, Static Site.
- For Select a variant, accept the default, Markdown Static Site.
You've created your first project!
The directory structure for the project looks like this:
The scaffolding for the static site contains a website layout using the Nunjucks templating language. It also contains markdown in the
content folder for
lwr.config.json file contains routes to navigate between these pages.
Now, run these commands to see the site on your localhost:
View the site in your browser on your localhost.
Deploying the Static Site to Heroku
Now that we have our static site up and running, deploying to Heroku is a breeze. Heroku uses the preset start script in your project's
package.json file, and LWR serves the app on Heroku in the same way as it does locally.
More to Come
We hope that this static site gives you a glimpse of the simplicity and flexibility of LWR. Soon we’ll provide full details on how to leverage the flexibility of LWR to build web apps, blogs, as well as deployment to different hosting environments. We’re just getting started and are excited that you’ll be on this journey with us.
We love to hear your comments or questions! Use the LWR on Node Trailblazer community topic to raise your questions.