{"id":32497523,"url":"https://github.com/abhishek10351/fastapi-nextjs-mongo-template","last_synced_at":"2026-04-15T14:02:59.079Z","repository":{"id":318028383,"uuid":"1064570233","full_name":"Abhishek10351/fastapi-nextjs-mongo-template","owner":"Abhishek10351","description":null,"archived":false,"fork":false,"pushed_at":"2025-10-04T15:05:25.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T17:21:05.145Z","etag":null,"topics":["fastapi","mongodb","nextjs","nodejs","python","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Abhishek10351.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-26T08:23:06.000Z","updated_at":"2025-10-04T15:05:28.000Z","dependencies_parsed_at":"2025-10-08T22:45:20.197Z","dependency_job_id":null,"html_url":"https://github.com/Abhishek10351/fastapi-nextjs-mongo-template","commit_stats":null,"previous_names":["abhishek10351/fastapi-nextjs-mongo-template"],"tags_count":null,"template":true,"template_full_name":null,"purl":"pkg:github/Abhishek10351/fastapi-nextjs-mongo-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhishek10351%2Ffastapi-nextjs-mongo-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhishek10351%2Ffastapi-nextjs-mongo-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhishek10351%2Ffastapi-nextjs-mongo-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhishek10351%2Ffastapi-nextjs-mongo-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Abhishek10351","download_url":"https://codeload.github.com/Abhishek10351/fastapi-nextjs-mongo-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abhishek10351%2Ffastapi-nextjs-mongo-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281287142,"owners_count":26475266,"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","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fastapi","mongodb","nextjs","nodejs","python","rest-api"],"created_at":"2025-10-27T14:49:58.616Z","updated_at":"2025-10-27T14:50:03.460Z","avatar_url":"https://github.com/Abhishek10351.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 FastAPI + Next.js + MongoDB Template\r\n\r\nA modern, production-ready full-stack template featuring FastAPI backend and Next.js frontend with MongoDB database. Complete with authentication, type safety, and best practices built-in.\r\n\r\n![FastAPI](https://img.shields.io/badge/FastAPI-0.116-009688?style=for-the-badge\u0026logo=fastapi)\r\n![Next.js](https://img.shields.io/badge/Next.js-15-black?style=for-the-badge\u0026logo=next.js)\r\n![MongoDB](https://img.shields.io/badge/MongoDB-4.4+-47A248?style=for-the-badge\u0026logo=mongodb)\r\n![TypeScript](https://img.shields.io/badge/TypeScript-5-3178C6?style=for-the-badge\u0026logo=typescript)\r\n![Python](https://img.shields.io/badge/Python-3.12+-3776AB?style=for-the-badge\u0026logo=python)\r\n\r\n## ✨ Features\r\n\r\n### 🔐 Authentication \u0026 Security\r\n\r\n- **JWT Authentication**: Secure token-based authentication\r\n- **User Management**: Complete user registration and profile management\r\n- **Password Security**: bcrypt hashing for secure password storage\r\n- **CORS Protection**: Configurable cross-origin request handling\r\n\r\n### 🚀 Backend Foundation\r\n\r\n- **FastAPI**: Modern async Python web framework\r\n- **Database**: MongoDB with async operations\r\n- **Authentication**: JWT tokens with secure implementation\r\n- **Validation**: Pydantic for data validation and serialization\r\n\r\n### 🎨 Frontend (Coming Soon)\r\n\r\n- **Next.js 15**: React framework with App Router\r\n- **React 19**: Latest React with concurrent features\r\n- **TypeScript**: Type-safe development\r\n- **Tailwind CSS**: Utility-first styling\r\n- **Redux Toolkit**: State management\r\n- **Radix UI**: Accessible component primitives\r\n\r\n### 📊 Developer Experience\r\n\r\n- **Type Safety**: Full TypeScript and Python type hints\r\n- **Auto Documentation**: OpenAPI/Swagger docs generated automatically\r\n- **Hot Reload**: Fast development with auto-reload\r\n- **Code Quality**: Ruff for backend, ESLint for frontend\r\n- **Testing**: Pytest for backend, Jest for frontend\r\n- **Environment Management**: Clean configuration management\r\n\r\n## 🚀 Quick Start\r\n\r\n### Prerequisites\r\n\r\n- **Python** 3.12+ and **uv** (or pip)\r\n- **Node.js** 18+ and **npm** (for upcoming frontend)\r\n- **MongoDB** 4.4+ (local or cloud)\r\n- **Git**\r\n\r\n### 1. Clone the Repository\r\n\r\n```bash\r\ngit clone https://github.com/Abhishek10351/fastapi-nextjs-mongo-template.git\r\ncd fastapi-nextjs-mongo-template\r\n```\r\n\r\n### 2. Environment Setup\r\n\r\nConfigure your backend environment:\r\n\r\n```bash\r\ncd server\r\ncp .env.example .env\r\n# Edit server/.env with your backend settings\r\n```\r\n\r\n**Required changes:**\r\n\r\n- Change `SECRET_KEY` from \"changethis\" to a secure random string\r\n- Change `FIRST_SUPERUSER_PASSWORD` from \"changethis\" to a secure password\r\n- Update `MONGODB_URI` if using a different MongoDB setup\r\n\r\n### 3. Backend Setup\r\n\r\n```bash\r\ncd server\r\n\r\n# Install dependencies\r\nuv sync\r\n\r\n# Start backend server\r\ncd app\r\nfastapi dev main.py\r\n```\r\n\r\nBackend will be available at: \u003chttp://localhost:8000\u003e\r\n\r\n- API Docs: \u003chttp://localhost:8000/docs\u003e\r\n- Alternative Docs: \u003chttp://localhost:8000/redoc\u003e\r\n\r\n## 📁 Project Structure\r\n\r\n```text\r\nfastapi-nextjs-mongo-template/\r\n├── client/                # Next.js Frontend (Coming Soon)\r\n│   ├── src/\r\n│   │   ├── app/          # App Router pages\r\n│   │   ├── components/   # React components\r\n│   │   ├── hooks/        # Custom hooks\r\n│   │   ├── lib/         # Utilities and API\r\n│   │   └── store/       # Redux store\r\n│   ├── public/          # Static assets\r\n│   ├── .env.local       # Frontend environment\r\n│   └── INSTALL.md       # Frontend setup guide\r\n├── server/               # FastAPI Backend ✅\r\n│   ├── app/\r\n│   │   ├── api/         # API routes\r\n│   │   ├── core/        # Core functionality\r\n│   │   ├── models.py    # Data models\r\n│   │   ├── db/          # Database operations\r\n│   │   └── utils/       # Utility functions\r\n│   ├── .env             # Backend environment\r\n│   └── INSTALL.md       # Backend setup guide\r\n└── README.md           # This file\r\n```\r\n\r\n\u003e **Status**: ✅ Backend Ready | 🚧 Frontend Coming Soon\r\n\r\n## 🛠️ Development\r\n\r\n### Backend Commands (Available Now)\r\n\r\n```bash\r\n# Development server (from app/ directory)\r\ncd app \u0026\u0026 fastapi dev main.py\r\n\r\n# Production server\r\ncd app \u0026\u0026 uv run fastapi run app/main.py\r\n\r\n# Run tests\r\nuv run pytest\r\n\r\n# Code linting and formatting\r\nuv run ruff check\r\nuv run ruff format\r\n```\r\n\r\n### Frontend Commands (Coming Soon)\r\n\r\n```bash\r\nnpm run dev      # Start development server\r\nnpm run build    # Build for production\r\nnpm run start    # Start production server\r\nnpm run lint     # Run ESLint\r\n```\r\n\r\n## 🔗 API Endpoints\r\n\r\n### Authentication\r\n\r\n- `POST /auth/register` - User registration\r\n- `POST /auth/login` - User login\r\n- `GET /auth/me` - Get current user\r\n\r\n### Users\r\n\r\n- `GET /users/me` - Get user profile\r\n- `PUT /users/me` - Update profile\r\n\r\n### Utility\r\n\r\n- `GET /ping` - Health check\r\n\r\n\u003e **Note**: Add your own business logic endpoints here. The template provides a solid foundation with authentication and user management.\r\n\r\n## 🌐 Environment Variables\r\n\r\n### Backend (server/.env)\r\n\r\n```bash\r\n# Required\r\nMONGODB_URI=mongodb://localhost:27017\r\nMONGODB_DB_NAME=your_app_name\r\nSECRET_KEY=your-secret-key\r\nFIRST_SUPERUSER=admin@example.com\r\nFIRST_SUPERUSER_PASSWORD=secure-password\r\n\r\n# Optional\r\nPROJECT_NAME=\"Your App Name\"\r\nACCESS_TOKEN_EXPIRE_MINUTES=11520  # 8 days\r\nENVIRONMENT=local\r\nBACKEND_CORS_ORIGINS=http://localhost:3000\r\n```\r\n\r\n## 🧪 Testing\r\n\r\n### Backend Tests (Available Now)\r\n\r\n```bash\r\ncd server\r\nuv run pytest                 # Run all tests\r\nuv run pytest --cov=app      # With coverage\r\nuv run pytest -v             # Verbose output\r\n```\r\n\r\n### Frontend Tests (Coming Soon)\r\n\r\n```bash\r\ncd client\r\nnpm run test                  # Run tests\r\nnpm run test:watch           # Watch mode\r\nnpm run test:coverage        # With coverage\r\n```\r\n\r\n## 🚀 Deployment\r\n\r\n### Production Environment\r\n\r\n1. **Set production environment variables**\r\n2. **Use production MongoDB instance**\r\n3. **Configure HTTPS and security headers**\r\n4. **Set up monitoring and logging**\r\n\r\n### Deployment Options\r\n\r\n- **Docker**: Use provided Dockerfiles\r\n- **Cloud Platforms**: Vercel (frontend), Railway/Render (backend)\r\n- **VPS**: Nginx + PM2/systemd\r\n- **Container Orchestration**: Kubernetes\r\n\r\n## 🔒 Security Features\r\n\r\n- JWT token authentication with 8-day expiration\r\n- bcrypt password hashing\r\n- CORS protection\r\n- Input validation with Pydantic\r\n- Environment-based configuration\r\n- Secure HTTP headers\r\n\r\n## 🤝 Contributing\r\n\r\nWe welcome contributions! Please see our contributing guidelines:\r\n\r\n1. Fork the repository\r\n2. Create a feature branch: `git checkout -b feature/amazing-feature`\r\n3. Make your changes and add tests\r\n4. Ensure all tests pass and code is formatted\r\n5. Commit your changes: `git commit -m 'Add amazing feature'`\r\n6. Push to the branch: `git push origin feature/amazing-feature`\r\n7. Open a Pull Request\r\n\r\n### Development Setup\r\n\r\n1. Follow the Quick Start guide above\r\n2. Install development dependencies\r\n3. Run tests to ensure everything works\r\n4. Make your changes\r\n5. Test your changes thoroughly\r\n\r\n## 📚 Documentation\r\n\r\n- [Backend Installation Guide](./server/INSTALL.md)\r\n- [Frontend Installation Guide](./client/INSTALL.md) (Coming Soon)\r\n- [API Documentation](http://localhost:8000/docs) (when running)\r\n- [FastAPI Documentation](https://fastapi.tiangolo.com/)\r\n- [Next.js Documentation](https://nextjs.org/docs)\r\n- [MongoDB Documentation](https://www.mongodb.com/docs/)\r\n\r\n## 🐛 Troubleshooting\r\n\r\n### Common Issues\r\n\r\n1. **MongoDB Connection Failed**\r\n   - Ensure MongoDB is running: `mongosh --eval \"db.runCommand('ping')\"`\r\n   - Check connection string in .env file\r\n\r\n2. **Port Already in Use**\r\n   - Backend: `lsof -i :8000` and kill the process\r\n   - Frontend: `lsof -i :3000` and kill the process\r\n\r\n3. **Environment Variables Not Loading**\r\n   - Ensure .env file is in the correct location\r\n   - Restart development servers after changes\r\n\r\n4. **JWT Token Issues**\r\n   - Change SECRET_KEY to a secure random string\r\n   - Clear browser storage and re-login\r\n\r\n### Getting Help\r\n\r\n- Check the [Issues](https://github.com/Abhishek10351/fastapi-nextjs-mongo-template/issues) page\r\n- Review the installation guide in `/server/INSTALL.md`\r\n- Join our community discussions\r\n\r\n## 📄 License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## 🙏 Acknowledgments\r\n\r\n- [FastAPI](https://fastapi.tiangolo.com/) for the amazing Python web framework\r\n- [Next.js](https://nextjs.org/) for the excellent React framework (coming soon)\r\n- [MongoDB](https://www.mongodb.com/) for the flexible document database\r\n- [Pydantic](https://docs.pydantic.dev/) for data validation and settings management\r\n\r\n---\r\n\r\n## 🚀 Happy Building\r\n\r\nMade with ❤️ by [Abhishek10351](https://github.com/Abhishek10351)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhishek10351%2Ffastapi-nextjs-mongo-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabhishek10351%2Ffastapi-nextjs-mongo-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabhishek10351%2Ffastapi-nextjs-mongo-template/lists"}