node-react-postgres
A Node.js-React.js-PostgreSQL Boilerplate
Prerequisites
-
Node.JS
-
PostgreSQL
Folder Structure
Config Files
- .config.env in Apiserver root directory
- NODE_ENV=development
- PORT=8000
- SAMPLEDB_USER=
- SAMPLEDB_PASSWORD=
- SAMPLEDB_ADDRESS=
- SAMPLEDB_PORT=
- SAMPLEDB_NAME=
- JWT_SECRET=my-jwt-secret
- SERVER_UNIFIER=
- CLIENT_UNIFIER=
- CLIENT_DATE_MULTIPLIER=
- JWT_EXPIRES_IN=
- .env in Client root directory
REACT_APP_CLIENT_UNIFIER=
- CLIENT_UNIFIER in apiserver should be the same as REACT_APP_CLIENT_UNIFIER in client for auth system to function properly.
Getting Started
-
Clone or download the project
-
Run "npm i" in the root of the project
-
Do this for the client and apiserver as well
-
Run the project with "npm start" for development (it will start apiserver and client respectively)
-
You can use "npm run build" in the root of the project to create a prod build
-
Run "node apiserver" for production
Apiserver
Client
npm start
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
npm test
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
npm run build
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.