This project is currently in active development. Major features have been implemented, including:
- User authentication and registration (JWT-based, secure password hashing)
- Role-based access control and group management
- Menu, cart, and order management endpoints
- Token refresh and logout functionality
- Telemetry, observability, and Kafka logging integration
- Docker and Docker Compose support
- Flutter mobile frontend for user creation/testing
Upcoming improvements:
- More comprehensive test coverage
- Enhanced error handling and validation
- API documentation (Swagger/OpenAPI)
- Production deployment guides
The LittleLemonAPI is a robust and scalable backend solution for managing restaurant operations. Built with GoLang, this API supports:
- User authentication and registration.
- Menu item management.
- Cart functionality for customers.
- Role-specific order management.
This API enables the seamless development of web and mobile applications for restaurant services.
- Secure Authentication: JWT-based access and refresh tokens.
- Flexible Database: MongoDB for scalable and dynamic data storage.
- Custom Middleware: Built-in authentication middleware without third-party plugins like Gin.
- Role-Based Access: Specific endpoints and permissions for Manager, Customer, and Delivery Crew.
- Pagination and Sorting: Enhanced performance for large datasets.
- Mobile App Integration: Supports interaction via a Flutter app.
Ensure you have the following installed:
logistics-api/
├── backend_test_app/ # Flutter mobile app (optional frontend)
├── driver/ # Go entry point
├── handlers/ # API endpoint handlers
├── middleware/ # Custom middleware (auth, etc.)
├── logkafka/ # Kafka logging integration
├── models/ # Database models and logic
├── telem/ # Telemetry and observability
├── utils/ # Utility functions (e.g., MongoDB helpers)
├── docker-compose.yml # Docker orchestration
├── go.mod, go.sum # Go dependencies
├── README.md # Project documentation
└── ...
- backend_test_app/: Contains a Flutter app for mobile frontend testing and integration.
- Go backend: All Go source code for the API is in the root-level folders (driver, handlers, etc).
-
Clone the repository:
git clone https://github.com/rhydian-olasupo/LittleLemonAPI.git cd LittleLemonAPI -
Install dependencies:
go mod tidy
-
Set up the environment variables by creating a
.envfile:DB_URI=mongodb://localhost:27017 JWT_SECRET=your_secret_key -
Run the server:
go run main.go
-
The API will be available at
http://localhost:8080.
You can run the API and MongoDB using Docker Compose:
docker-compose up --buildThis will start both the Go API and a MongoDB instance as defined in docker-compose.yml.
- POST
/api/users: Register a new user. - POST
/token/login/: Authenticate user and generate tokens. - POST
/token/refresh_token: Renew access token using the refresh token. - GET
/api/users/me/: Retrieve current user details.
- GET
/menu-items: List all menu items (All Roles). - POST
/menu-items: Add a new menu item (Manager Only). - GET
/menu-items/{menuItemID}: Fetch menu item details. - PUT, PATCH
/menu-items/{menuItemID}: Update a menu item (Manager Only). - DELETE
/menu-items/{menuItemID}: Delete a menu item (Manager Only).
- GET
/cart/menu-items: Retrieve cart items (Customer Only). - POST
/cart/menu-items: Add menu items to the cart. - DELETE
/cart/menu-items: Clear the cart for the current user.
- GET
/orders: View all orders (Role-specific access). - POST
/orders: Place a new order using cart items (Customer Only). - GET
/orders/{orderID}: View details of a specific order. - PUT, PATCH
/orders/{orderID}: Assign delivery crew or update status (Manager Only). - PATCH
/orders/{orderID}: Update delivery status (Delivery Crew Only).
- GET, POST, DELETE
/groups/managers: Manage Manager group. - GET, POST, DELETE
/groups/delivery-crew: Manage Delivery Crew group.
- JWT Authentication: Secure sessions with token-based authentication.
- Custom Middleware: Authentication and authorization without external frameworks.
- MongoDB Integration: Flexible and NoSQL database for dynamic data models.
- Kafka Logging: Integrated Kafka for event and audit logging.
- ElasticSearch & Kibana: Support for advanced search, analytics, and real-time monitoring/visualization via ElasticSearch and Kibana.
- Rate Limiting: API throttling for authenticated and unauthenticated users.
- Sorting and Pagination: Optimized responses for large datasets.
- Language: GoLang
- Database: MongoDB
- Routing: Gorilla Mux
- Password Security: Bcrypt
- Mobile Frontend: Flutter
- Containerization: Docker, Docker Compose
We welcome contributions! To get started:
- Fork the repository.
- Create a new branch (
feature/your-feature-name). - Commit your changes and push.
- Submit a Pull Request for review.