DEV Community

Cover image for API Project Template V2.0.0
Miftahul Arifin
Miftahul Arifin

Posted on

2 1

API Project Template V2.0.0

Several months ago, I posted API Project Template, Written in Typescript about boilerplate for building API project in Typescript.

Now, I made some changes especially in code style consistency, unit test coverage, swagger docs, and types.

What's new?

  • Improve coverage unit test on repositories and services using Jest

Unit test coverage

  • Refactor project structure as below
├── .husky/                     # Pre-commit config for lint staged
├── docs/                       # Swagger API docs
├── src/                        # All application source
├──── @types/                   # Type definition for modules
|
├──── api/
├────── controllers/            # Define all controllers
├────── middlewares/            # Define all middlewares
├────── models/                 # Define all sequelize models
├────── repositories/           # Define all repositories
├────── routes/
├──────── v1/                   # Define all v1 routes
├────── services/               # Define all services
├────── types/                  # Define all input types
|
├──── config/
├────── appConfig.ts            # Define app configuration
|
├──── constants/                # Define all constants
├──── database/                 # Define database connection and sync tables
├──── utils/                    # Define reusable libs
├──── server.ts                 # Create express config
├──── index.ts                  # ENTRYPOINT - Start server
|
└── ...
Enter fullscreen mode Exit fullscreen mode
  • Improve code style using class in repositories, services, and controllers
  • Add express validator as middleware to validate API request
  • and moreover...

See details of API Project Template v2.0.0 in this repo
arifintahu/project-structure-api - GitHub

SurveyJS custom survey software

Simplify data collection in your JS app with a fully integrated form management platform. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more. Integrates with any backend system, giving you full control over your data and no user limits.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay