https://github.com/rixcian/node-typescript-api-starter
Starter project for REST API (Node, Typescript, Express, MikroORM, Passport, ...)
https://github.com/rixcian/node-typescript-api-starter
expressjs mikro-orm nodejs typescript
Last synced: 22 days ago
JSON representation
Starter project for REST API (Node, Typescript, Express, MikroORM, Passport, ...)
- Host: GitHub
- URL: https://github.com/rixcian/node-typescript-api-starter
- Owner: rixcian
- Created: 2021-11-20T09:02:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-02T16:13:00.000Z (over 4 years ago)
- Last Synced: 2025-06-15T00:38:39.977Z (11 months ago)
- Topics: expressjs, mikro-orm, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node Typescript REST API Starter
## Used Technologies
- Node.js
- Typescript
- Express.js
- MikroORM
- Passport
- PostgreSQL
- Prettier
## Development
1. Clone this repo
2. Install dependencies with `yarn install`
3. Rename `.env.sample` to `.env`
4. Update variables in `.env` file
5. If you're using different DB than PostgreSQL run these commands
```markdown
1. Remove @mikro-cli/postgresql package
- `yarn remove @mikro-cli/postgresql`
2. Install different DB driver (https://mikro-orm.io/docs/installation/)
- e.g. `yarn add @mikro-cli/mysql`
3. Update `DB_TYPE` variable in `.env` file
```
6. Run migrations
7. Run project in development mode with `yarn dev`
## Deployment
1. Clone this repo to deployment server
2. Install dependencies `yarn install`
3. Rename `.env.sample` to `.env`
4. Update variables in `.env` file
5. Build app with `yarn build`
6. Create `frontend` folder inside `./dist`
7. Copy built React app into `./dist/frontend` folder
## Commands
All commands are specified inside `package.json` file
### `yarn dev`
Running app in `development` mode (auto-compile & auto-restart after change).
### `yarn build`
Builds app into `dist` folder
### `yarn start`
Running built app from `dist` folder
### `yarn entities:generate`
Generates entities from DB & saves them into `src/db/entities` folder
### `yarn migration:create`
Creates a new migration file (in `src/db/migrations`) witch applied changes inside entities
### `yarn migration:up`
Applies all (not applied) migrations to DB
## Deployment
1. `$ docker build . -t node-typescript-api`
2. `$ docker run -p 8000:8000 -d --env-file .env --name api-starter node-typescript-api:latest`
## Linters
`TODO`