https://github.com/arunkumar201/nodeexpress-ts-api-starter
A comprehensive starter kit for building robust APIs using Node.js, Express, and TypeScript. Kickstart your project with a well-organized structure, pre-configured settings, and essential features for efficient API development. Save time on setup and focus on crafting high-quality, scalable APIs.
https://github.com/arunkumar201/nodeexpress-ts-api-starter
express mongodb nodejs typescript
Last synced: 3 months ago
JSON representation
A comprehensive starter kit for building robust APIs using Node.js, Express, and TypeScript. Kickstart your project with a well-organized structure, pre-configured settings, and essential features for efficient API development. Save time on setup and focus on crafting high-quality, scalable APIs.
- Host: GitHub
- URL: https://github.com/arunkumar201/nodeexpress-ts-api-starter
- Owner: arunkumar201
- Created: 2023-12-24T08:39:47.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-24T08:40:26.000Z (over 2 years ago)
- Last Synced: 2025-02-10T15:18:41.285Z (over 1 year ago)
- Topics: express, mongodb, nodejs, typescript
- Language: TypeScript
- Homepage: https://github.com/arunkumar201/NodeExpress-TS-API-Starter
- Size: 25.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node RESTful APIs
## Quick Start
Install the dependencies:
```bash
yarn install
```
Set the environment variables:
```bash
cp .env.example .env
# open .env and modify the environment variables (if needed)
```
## Commands
Running locally:
```bash
yarn dev
```
Running in production:
```bash
yarn start
```
Testing:
```bash
# run all tests
yarn test
# run all tests in watch mode
yarn test:watch
# run test coverage
yarn coverage
```
Linting:
```bash
# run ESLint
yarn lint
# fix ESLint errors
yarn lint:fix
# run prettier
yarn prettier
# fix prettier errors
yarn prettier:fix
```
## Environment Variables
The environment variables can be found and modified in the `.env` file. They come with these default values:
```bash
# Port number
PORT=3000
# URL of the Mongo DB
MONGODB_URL=mongodb://127.0.0.1:27017/Node-Typescript-Starter
# JWT
# JWT secret key
JWT_SECRET=thisisasamplesecret
# Number of minutes after which an access token expires
JWT_ACCESS_EXPIRATION_MINUTES=30
# Number of days after which a refresh token expires
JWT_REFRESH_EXPIRATION_DAYS=30
```
## Project Structure
```
src\
|--config\ # Environment variables and configuration related things
|--controllers\ # Route controllers (controller layer)
|--docs\ # Swagger files
|--middlewares\ # Custom express middlewares
|--models\ # Mongoose models (data layer)
|--routes\ # Routes
|--services\ # Business logic (service layer)
|--utils\ # Utility classes and functions
|--validations\ # Request data validation schemas
|--app.ts # Express app
|--index.ts # App entry point
```
## API Documentation
To view the list of available APIs and their specifications, run the server and go to `http://localhost:3000/v1/docs` in your browser.