{"id":16175457,"url":"https://github.com/app-generator/api-server-nodejs-mongo","last_synced_at":"2025-03-19T00:31:20.436Z","repository":{"id":41421304,"uuid":"387805881","full_name":"app-generator/api-server-nodejs-mongo","owner":"app-generator","description":"Nodejs API Server - Express / SQLite / MongoDB | AppSeed","archived":false,"fork":false,"pushed_at":"2022-12-02T15:47:49.000Z","size":82,"stargazers_count":11,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-11T05:55:14.021Z","etag":null,"topics":["api-rest","appseed","appseed-sample","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://appseed.us/boilerplate-code/nodejs-starter/","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/app-generator.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-20T13:46:03.000Z","updated_at":"2024-01-12T13:09:14.000Z","dependencies_parsed_at":"2023-01-23T08:45:10.735Z","dependency_job_id":null,"html_url":"https://github.com/app-generator/api-server-nodejs-mongo","commit_stats":null,"previous_names":[],"tags_count":5,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/app-generator%2Fapi-server-nodejs-mongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/app-generator%2Fapi-server-nodejs-mongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/app-generator%2Fapi-server-nodejs-mongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/app-generator%2Fapi-server-nodejs-mongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/app-generator","download_url":"https://codeload.github.com/app-generator/api-server-nodejs-mongo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955697,"owners_count":20374373,"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-rest","appseed","appseed-sample","nodejs","typescript"],"created_at":"2024-10-10T04:44:52.894Z","updated_at":"2025-03-19T00:31:20.111Z","avatar_url":"https://github.com/app-generator.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# [Nodejs API Server](https://appseed.us/boilerplate-code/nodejs-starter/) `Mongo`\n\nSimple starter built with Typescrypt / Express / MongoDB and JWT Auth powered by **Passport** library - provided and actively supported by **AppSeed** [App Generator](https://appseed.us/app-generator). The authentication flow is based on [json web tokens](https://jwt.io) and `passport-jwt` strategy - Inspired by other great OSS starters mentioned in the [credits](#credits) section.\n\n\u003cbr /\u003e\n\n\u003e Features:\n\n- ✅ [API Definition](https://docs.appseed.us/boilerplate-code/api-unified-definition) - the unified API structure implemented by this server\n- ✅ Simple, intuitive codebase - built for beginners (can be extended with ease) \n- ✅ Node JS / Express / Typescript\n- ✅ **Persistance**:  `MongoDB`\n- ✅ Auth: Passport / `passport-jwt` strategy \n- ✅ `Docker` \n\n\u003cbr /\u003e\n\n\u003e Can be used with other [React Starters](https://appseed.us/apps/react) for a complete **Full-Stack** experience:\n\n| [React Node JS Berry](https://appseed.us/product/berry-dashboard/api-server-nodejs/react/) | [React Node Soft Dashboard](https://appseed.us/product/soft-ui-dashboard/api-server-nodejs/react/) | [React Node Horizon](https://appseed.us/product/horizon-ui/api-server-nodejs/) |\n| --- | --- | --- |\n| [![React Node JS Berry](https://user-images.githubusercontent.com/51070104/176936514-f1bccb21-bafe-4b43-9e4c-b6fe0ec9511d.png)](https://appseed.us/product/berry-dashboard/api-server-nodejs/react/) | [![React Node Soft Dashboard](https://user-images.githubusercontent.com/51070104/176936814-74386559-4e05-43d5-b9a4-8f70ce96a610.png)](https://appseed.us/product/soft-ui-dashboard/api-server-nodejs/react/) | [![React Node Horizon](https://user-images.githubusercontent.com/51070104/174428337-181e6dea-0ad9-4fe1-a35f-25e5fa656a9d.png)](https://appseed.us/product/horizon-ui/api-server-nodejs/)\n\n\u003cbr /\u003e\n\n![Nodejs API Server - Open-source Nodejs Starter provided by AppSeed.](https://user-images.githubusercontent.com/51070104/124414813-142aa180-dd5c-11eb-9279-6b082dadc51a.png)\n\n\u003cbr /\u003e\n\n## Requirements\n\n- [Node.js](https://nodejs.org/) \u003e= 10.x\n- [MongoDB](https://www.mongodb.com/) server \n\n\u003cbr /\u003e\n\n## How to use the code\n\n**Create** `.env` from `.env.sample`\n\nUpdate the file with your data.\n\n**Clone the sources**\n\n```bash\n$ git clone https://github.com/app-generator/api-server-nodejs-mongo.git\n$ cd api-server-nodejs-mongo\n```\n\n**Install dependencies** via NPM or Yarn\n\n```bash\n$ npm i\n// OR\n$ yarn\n```\n\n**Start the API server** - development mode\n\n```bash\n$ npm dev\n// OR\n$ yarn dev\n```\n\n**Start the API server** - for production (files served from `build/build/index.js`)\n\n```bash\n$ npm start\n// OR\n$ yarn start\n```\n\nThe API server will start using the `PORT` specified in `.env` file (default 5000)\n\n\u003cbr /\u003e\n\n## Codebase Structure\n\n```bash\n\u003c ROOT / src \u003e\n     | \n     |-- config/                              \n     |    |-- config.ts             # Configuration       \n     |    |-- passport.ts           # Define Passport Strategy             \n     | \n     |-- models/                              \n     |    |-- activeSession.ts      # Sessions Model (Mongo)              \n     |    |-- user.ts               # User Model (Mongo) \n     | \n     |-- routes/                              \n     |    |-- users.ts              # Define Users API Routes\n     | \n     | \n     |-- index.js                     # API Entry Point\n     |-- .env                       # Specify the ENV variables\n     |                        \n     |-- ************************************************************************\n```\n\n\u003cbr /\u003e\n\n## Mongo Settings\n\nThe Mongo URI lives in `config/keys.js`\n\n```javascript\n... = 'mongodb://localhost/api_server_nodejs'\n```\n\n\u003cbr /\u003e\n\n## API\n\nFor a fast set up, use this POSTMAN file: [api_sample](https://github.com/app-generator/api-server-nodejs/blob/master/media/api.postman_collection.json)\n\n\u003e **Register** - `api/users/signup`\n\n```\nPOST api/users/signup\nContent-Type: application/json\n\n{\n    \"username\":\"test\",\n    \"password\":\"pass\", \n    \"email\":\"test@appseed.us\"\n}\n```\n\n\u003cbr /\u003e\n\n\u003e **Login** - `api/users/login`\n\n```\nPOST /api/users/login\nContent-Type: application/json\n\n{\n    \"password\":\"pass\", \n    \"email\":\"test@appseed.us\"\n}\n```\n\n\u003cbr /\u003e\n\n\u003e **Logout** - `api/users/logout`\n\n```\nPOST api/users/logout\nContent-Type: application/json\nauthorization: JWT_TOKEN (returned by Login request)\n\n{\n    \"token\":\"JWT_TOKEN\"\n}\n```\n\n\u003cbr /\u003e\n\n## License\n\nMIT @ [AppSeed](https://appseed.us)\n\n\u003cbr /\u003e\n\n## Credits\n\nThis software is provided by the core AppSeed team with an inspiration from other great NodeJS starters: \n\n- Initial verison - coded by [Teo Deleanu](https://www.linkedin.com/in/teodeleanu/)\n- [Hackathon Starter](https://github.com/sahat/hackathon-starter) - A truly amazing boilerplate for Node.js apps\n- [Node Server Boilerplate](https://github.com/hagopj13/node-express-boilerplate) - just another cool starter\n- [React NodeJS Argon](https://github.com/creativetimofficial/argon-dashboard-react-nodejs) - released by **Creative-Tim** and [ProjectData](https://projectdata.dev/)\n\n\u003cbr /\u003e\n\n---\n[Nodejs API Server](https://appseed.us/boilerplate-code/nodejs-starter/) `Mongo` - provided by AppSeed [App Generator](https://appseed.us)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapp-generator%2Fapi-server-nodejs-mongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapp-generator%2Fapi-server-nodejs-mongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapp-generator%2Fapi-server-nodejs-mongo/lists"}