An open API service indexing awesome lists of open source software.

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.

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.