This is a boilerplate project used for starting new projects!
Complete the following steps to set up a new boilerplate:
- Clone this repo
cdinto cloned repository- Make a fresh start of the git history with
rm -rf .git && git init - Install dependencies with
npm install - Move the example .env file to
.envthat will be ignored by git and read by and read by the express servermv example.env .env - Edit the contents of the
package.jsonto use NEW-PROJECT-NAME instead of"name": "express-boilerplate", - If using PostgreSQL with Postgrator, checkout the
psqlbranchgit checkout psql - For a REST API boiler plate with JWT auth system in place, checkout the
authbranchgit checkout auth - For a simple Express/GraphQL server checkout the
graphqlbranchgit checkout graphql
Start the REST API server with npm run dev or npm start
Start the GraphQL server with node src/server.js
Run database migrations npm run migrate
Run the texts npm test
(steps 4-8 for deploy with database addon)
-
Log in to Heroku CLI
heroku login -
Make a new project
heroku create <name-of-project> -
Push to Heroku
git push heroku main -
Create the database addon
heroku addons:create heroku-postgresql:hobby-dev -
Get the database url
heroku pg:credentials:url -
Insert the url
psql <url> -
Run production migrations
npm run migrate:production -
Seed the production database
cat <file-name> | heroku pg:psql