Stack:
- React with Typescript (SPA)
- NestJS (API)
- Postgres (DB)
Hosting: Firebase hosting
app
└── client (SPA code)
└── api (API code)
Client side requires for user
key stored in localStorage
. Please initialize the user
key with string:
localStorage.user = JSON.stringify({"user_phone_number":"1234567890",
"user_id":"EABbI9VXXZMUK8pbuVJzkLlyYf12",
"user_email":"[email protected]",
user_name":"John Doe",
"user_dob":{"_seconds":810239100,"_nanoseconds":0},
"user_gender":"MALE"});
This information will set when index.html
loads after authentication with the platform.
Development
yarn start
Production
yarn build
Make changes to exports.sh
file under api
folder with the required settings and run:
. ./exports.sh
to export the ENV in user terminal before starting the server.
Development
yarn start:dev
Production
Note: Run SPA's prod build before running this.
yarn start:prod
API reference
http://localhost:3001/api
Create Database smartcity
createdb -O smartcity smartcity
Starting the API server should automatically create the tables using typeorm
defined entities.
Relations
Seed the DB using api/db/migrations/seed.sql
manually
TODO: Use typeorm to run seed migration
Docker
Modify environment
in docker-compose.yml
then run
docker-compose up -d