Please use:
- Node.js:
>=18
- database:
PostgreSQL
,MySQL
orMariaDB
- Create .env
Necessary
DATABASE_DBNAME=dbname
DATABASE_USER=myuser
DATABASE_PASSWORD=mypassword
JWT_SECRET=secret
Can use as default
DATABASE_TYPE=type (default 'postgres')
APP_PORT=port (default 3000)
DATABASE_HOST=host (default 'localhost')
DATABASE_PORT=port (default 5432)
JWT_EXP_TIME=time (default 15m')
Change default settings
src/config/app.default.config.ts
{
main: {
state: 'production',
port: 3000,
engine: 'express' | 'fastify',
},
auth: {
jwtExpTime: '15m',
},
db: {
host: 'localhost',
port: 5432,
user: 'postgres',
},
};
$ pnpm install
# development
$ pnpm run start
# watch mode
$ pnpm run start:dev
# build application
$ pnpm run build
# production mode
$ pnpm run start:prod
$ pnpm run typeorm:create-migration # Create a migration
$ pnpm run typeorm:generate-migration # Generate a migration
$ pnpm run typeorm:run-migrations # Run a migration
$ pnpm run typeorm:revert-migration # Revert a migration