This FastAPI-based RESTful API powers the TuShare mobile app.
- Authentication - login, signup & logout
- Profile management - view and update user profile
- Password hashing for enhanced security.
- Book rides, search for available rides and view booked rides
- In-app messaging between passengers and drivers
- Database integration using SQLAlchemy.
- Error handling for unique constraint violations.
- FastAPI - Python web framework for building REST APIs.
- SQLite - Database for data persistence.
- SQLAlchemy - ORM for database interactions.
- Pydantic - Data validation.
- UUID - Unique ID generation.
- Shutil & OS - File system operations.
- Clone the repository:
git clone https://github.com/morikeli/TuShare-backend.git
- Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Linux/Mac
venv\Scripts\activate # On Windows
- Install dependencies:
pip install -r requirements.txt
- Run the FastAPI server:
uvicorn app:app --reload
The server will start at: http://localhost:8000
You can test the API using Postman or the FastAPI interactive docs:
http://localhost:8000/api/v1/docs # swagger docs
http://localhost:8000/api/v1/redoc # redoc
📦project-root
│
├── 📂 app
│ └── 📂 core
| | └── 📄 __init__.py
| | └── 📄 config.py
| | └── 📄 database.py
| | └── 📄 dependencies.py
| | └── 📄 redis.py
| | └── 📄 token_bearer.py
│ └── 📂 mails
| | └── 📄 __init__.py
| | └── 📄 send_mail.py
│ └── 📂 middleware
| | └── 📄 __init__.py
| | └── 📄 auth_middleware.py
│ └── 📂 models
| | └── 📄 __init__.py
| | └── 📄 base.py
| | └── 📄 booking.py
| | └── 📄 messages.py
| | └── 📄 rides.py
| | └── 📄 user.py
│ └── 📂 routers
| | └── 📄 __init__.py
| | └── 📄 auth.py
| | └── 📄 messages.py
| | └── 📄 rides.py
| | └── 📄 users.py
│ └── 📂 schemas
| | └── 📄 __init__.py
| | └── 📄 auth_schema.py
| | └── 📄 booking_schema.py
| | └── 📄 messages_schema.py
| | └── 📄 rides_schema.py
| | └── 📄 user_schema.py
│ └── 📂 service
| | └── 📄 __init__.py
| | └── 📄 auth_service.py
| | └── 📄 booking_service.py
| | └── 📄 messages_service.py
| | └── 📄 rides_service.py
| | └── 📄 user_service.py
│ └── 📂 utils
| | └── 📄 __init__.py
| └── 📄 __init__.py
| └── 📄 exceptions.py
├── 📂 media
│ └── 📂 dps
├── 📂 migrations
│ └── 📂 versions
│ └── 📄 env.py
│ └── 📄 README.md
│ └── 📄 script.py.mako
├── 📄 scripts
│ └── 📄 __init__.py
│ └── 📄 seed_db.py
├── 📄 templates
│ └── 📄 email-verification.html
│ └── 📄 reset-password.html
|
├── 📄 .env
├── 📄 .gitignore
├── ⚙️ alembic.ini
├── 📄 auth.py
├── 📄 config.py
├── 📄 __init__.py
├── 📄 main.py
├── 📄 models.py
└── 📄 README.md
├── 📄 requirements.txt
├── 📄 utils.py
Contributions are welcome! Please fork the repository and submit a pull request.
If you encounter any issues, please create an issue here.
Made with
♥️ . Don't hit the star button ⭐ to star this repo
✨ Happy Coding! 🚀