This project aims to create a base structure for various backend projects using NodeJS and TypeScript. It provides a foundational framework to kickstart any backend server implementation in NodeJS, streamlining the setup process and ensuring a consistent starting point. Includes essential configurations, best practices, and scalable architecture.
- Error Handling: Implements an error handler that returns JSON errors compliant with RFC 7807.
- Parameter Validation: Includes a parameter validator to ensure robust API input handling.
- Dependency Injection: Comes with a complete setup to manage dependency injection, facilitating a scalable and maintainable architecture.
- Example Project: Includes a base example demonstrating the usage and capabilities of the framework.
- Node.js (v14.x or later)
- npm (v6.x or later) or yarn
-
Clone the repository:
git clone https://github.com/your-username/NodeJS-Base-Backend.git cd NodeJS-Base-Backend
-
Install dependencies:
npm install
or
yarn install
To see the framework in action, you can run the included base example:
-
Start the development server:
npm run dev
or
yarn dev
-
Open your browser and navigate to
http://localhost:3000
to see the example in action.
src/
: Contains the source code for the base backend project.controllers/
: Controllers for handling HTTP requests.middlewares/
: Custom middleware functions, including error handlers.routes/
: API route definitions.services/
: Business logic and services.utils/
: Utility functions and helpers.validators/
: Parameter validation schemas.index.ts
: Entry point of the application.
Contributions are welcome! Please fork the repository and create a pull request with your changes. Make sure to follow the existing code style and add tests for any new features or bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.
For any inquiries or issues, please open an issue on the GitHub repository.
Happy coding!