{"id":19389490,"url":"https://github.com/amn-max/nodefuel","last_synced_at":"2025-04-24T00:30:53.265Z","repository":{"id":153296340,"uuid":"626777106","full_name":"amn-max/NodeFuel","owner":"amn-max","description":"NodeFuel is a TypeScript-first boilerplate for building high-quality Node.js apps with multi-authentication using Passport. Get started today and fuel up your Node.js development!","archived":false,"fork":false,"pushed_at":"2023-09-22T11:35:44.000Z","size":1630,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T22:33:09.986Z","etag":null,"topics":["api-development","best-practices","boilerplate","boilerplate-template","dotenv","eslint","express","multi-auth","multi-authentication","nodejs","passport","prisma","restful-api","typescript","web-development"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amn-max.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-04-12T06:24:39.000Z","updated_at":"2024-12-21T17:30:06.000Z","dependencies_parsed_at":"2023-09-23T13:03:53.970Z","dependency_job_id":"989d1ac5-c9d5-471f-8ea1-edfec92b9855","html_url":"https://github.com/amn-max/NodeFuel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amn-max%2FNodeFuel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amn-max%2FNodeFuel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amn-max%2FNodeFuel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amn-max%2FNodeFuel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amn-max","download_url":"https://codeload.github.com/amn-max/NodeFuel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250539305,"owners_count":21447286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-development","best-practices","boilerplate","boilerplate-template","dotenv","eslint","express","multi-auth","multi-authentication","nodejs","passport","prisma","restful-api","typescript","web-development"],"created_at":"2024-11-10T10:16:24.334Z","updated_at":"2025-04-24T00:30:52.895Z","avatar_url":"https://github.com/amn-max.png","language":"TypeScript","readme":"# NodeFuel: A TypeScript-First Boilerplate for Building High-Quality Node.js Applications\n\nNodeFuel is a powerful Node.js boilerplate that is designed to help you build high-quality backend applications with ease. It comes equipped with TypeScript, Prisma ORM, and a range of other essential tools that make it easy to get started with your project quickly. The boilerplate is built on an Express stack and has been developed with a focus on security, scalability, and flexibility.\n\n## Project Structure\n\n    prisma/\n    ┣ migrations/\n    ┗ schema.prisma\n    src/\n    ┣ api/\n    ┃ ┣ auth/\n    ┃ ┣ errors/\n    ┃ ┣ middlewares/\n    ┃ ┣ routes/\n    ┃ ┗ services/\n    ┣ config/\n    ┃ ┣ express.ts\n    ┃ ┣ logger.ts\n    ┃ ┗ vars.ts\n    ┣ helpers/\n    ┃ ┗ helpers.ts\n    ┣ libs/\n    ┃ ┣ **mocks**/\n    ┃ ┗ prisma.ts\n    ┣ tests/\n    ┃ ┗ services/\n    ┣ views/\n    ┃ ┗ error.ejs\n    ┣ generator.ts\n    ┗ index.ts\n    tmp/\n    ┗ sessions/\n\n## Multi-Authentication Feature\n\nIn addition to its existing features, NodeFuel now supports multi-authentication using Passport. You can easily configure the boilerplate to support authentication with popular social media platforms like Google, Facebook, Twitter, and Github. This feature makes it easy to create secure applications that allow users to sign in with their social media accounts.\n\nNodeFuel provides multi-authentication support using Passport with various providers such as Google, Facebook, Twitter, and Github. The `vars.ts` file, located in `src/config/vars.ts`, contains boolean flags for each of these providers.\nTo enable authentication with a particular provider, set the corresponding flag to `true`. For example, if you want to enable authentication with Google, set `useGoogleStrategy` to `true`.\n\nNote that in order to use any of the third-party authentication strategies, you must provide valid credentials (client ID and secret) for the corresponding provider. Once you have obtained these credentials, you can set them as environment variables in your `.env` file using the following naming convention:\n\n```env\nGOOGLE_CLIENT_ID=your_client_id\nGOOGLE_CLIENT_SECRET=your_client_secret\nFACEBOOK_APP_ID=your_app_id\nFACEBOOK_APP_SECRET=your_app_secret\nTWITTER_CONSUMER_KEY=your_consumer_key\nTWITTER_CONSUMER_SECRET=your_consumer_secret\nGITHUB_CLIENT_ID=your_client_id\nGITHUB_CLIENT_SECRECT=your_client_secret\n```\n\nReplace `your_client_id`, `your_client_secret`, etc. with the corresponding values provided by the third-party provider.\n\nWith these environment variables set, NodeFuel will automatically configure Passport with the appropriate strategies and credentials, allowing you to easily implement authentication with multiple providers in your application.\n\n## Getting Started\n\nTo get started with NodeFuel, you need to clone the repository and install its dependencies:\n\n- `git clone https://github.com/amn-max/NodeFuel.git`\n- `cd NodeFuel`\n- `npm install`\n\nThen, you can run the development server: `npm run dev`\n\nThis command will start the server in development mode and will automatically restart it when you make changes to your code.\n\nTo build your project for production, you can run: `npm run build`\n\nThis command will compile your TypeScript code to JavaScript and place it in the `build/` directory. You can then start the production server with: `npm start`\n\n## Features\n\nNodeFuel comes equipped with a range of powerful features that make it easy to build high-quality Node.js applications quickly and efficiently. These features include:\n\n- TypeScript-first approach for type safety and scalability\n- Built with popular stacks like Express, Prisma, and Dotenv\n- API route generator script for quickly creating basic CRUD endpoints for new models\n- API documentation generation with Apidoc\n- Production-ready configuration with PM2 and Cross-env\n- Easy project cleanup with Rimraf\n- Husky for Git hooks and automated testing\n- Comprehensive and easy-to-use error handling with Http-Status\n- Increased security with Helmet middleware\n- CORS middleware for secure cross-origin resource sharing\n- Compression middleware for faster server response times\n- Method-override middleware for easy HTTP method overriding\n- Express-validation middleware for request validation and error handling\n\n## API Route Generator\n\nYou can use the included API route generator script to quickly generate basic CRUD endpoints for a new model. To use the script, run the following command:\n\n`npm run generate ModelName`\n\nReplace `ModelName` with the name of your model. The script will generate a new file in the `src/api/routes` directory with basic route handlers for the model's CRUD operations.\n\nNote that the script assumes that the model has already been defined in your prisma.schema file and that you have generated the Prisma client by running `npx prisma generate`.\n\n## Session Management\n\nThis boilerplate uses Express Session middleware to manage user sessions. A local session store has been implemented using `session-file-store` package.\n\nBy default, the session middleware uses a memory store, but this can cause issues in production environments when running multiple server instances or restarting the server. Using a persistent store like session-file-store ensures that session data is stored securely and can be retrieved even if the server is restarted.\n\nTo configure session settings, edit the `config/express.ts` file. By default, the session middleware uses a secret key for signing the session ID cookie. You should change this to a unique value in production to ensure the security of user sessions.\n\n## Testing\n\n- `npm run test:unit`\n\nThis command will run the unit tests using the configuration file `vitest.config.unit.ts`.\n\nIf you want to run the unit tests with the UI, use the following command:\n\n- `npm run test:unit:ui`\n\nThis command will run the unit tests using the configuration file `vitest.config.unit.ts` and display the UI in the\nbrowser.\n\n## Scripts\n\nNodeFuel comes with a number of useful scripts that you can use to develop and build your app:\n\n- `npm run dev`: Start the development server with Nodemon.\n- `npm run build`: Build your app for production.\n- `npm start`: Start the production server.\n- `npm run lint`: Lint your TypeScript code using ESLint.\n- `npm run docs`: Generate API documentation using apidoc.\n- `npm run postdocs`: Open the generated API documentation in your default browser.\n- `npm run validate`: Validate your code by running the linting and testing scripts.\n\n## Contributing\n\nIf you find a bug or want to contribute to NodeFuel, feel free to open an issue or submit a pull request.\n\n## Inspirations\n\n- [danielfsousa/express-rest-boilerplate](https://github.com/danielfsousa/express-rest-boilerplate)\n\n## License\n\n[MIT License](README.md) - [Ayush Naik](https://github.com/amn-max)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famn-max%2Fnodefuel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famn-max%2Fnodefuel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famn-max%2Fnodefuel/lists"}