Before starting the project, make sure npm, node, docker and docker-compose is installed. requirements:
- node 14.16.1
- docker
- docker-compose 1.25^
copy and paset this into your terminal:
git clone git@github.com:Albin-Rohde/no-name.git && cd ./no-name && chmod +x init.sh && ./init.shThis will install all dependencies and pull the required docker images.
-
Start databases
This app use redis and postgres as databases, these should be running before starting the app
docker-compose up -d
-
Run migrations
To create all tables in the postgres database this app uses migrations. Run all migrations before starting the app.
cd ./server && npm run migration:run
-
Start Frontend
Start the frontend app in development mode will make it auto reload on changes
cd ./frontend && npm run dev
-
Start backend
Start the backend in development mode will make it auto reload on changes.
cd ./server && npm run dev
Frontend and backend can now be accessed on:
- Frontend - https://localhost:3000
- Backend - https://localhost:5000
To create new migration, first make the changes to the model(s). When you are happy with the alterations
go to server root (./server) and run npm run typeorm migration:generate -- -n <name>. This will create a migration in server/src/migrations.
Check that it looks correct and make changes if needed. When happy apply the migrations by running npm run migration:run.
To revert a migration run npm run migration:revert from server root (./server).
| Server commans | Description |
|---|---|
npm run dev |
Run server in dev mode |
npm run prod |
Run server in prod mode |
npm run migration:run |
Runs migration from ts source |
npm run migration:revert |
Revert last migration |
npm run migration-prod:run |
Runs migration from build js |
npm run typeorm migration:generate -- -n <name> |
Creates a new migration |
| Frontend commans | Description |
|---|---|
npm run dev |
Run frontend in dev mode |
npm run build |
Builds a build bundle to serve in prod mdoe |
npm run prod |
Run frontend in prod mode |