This application provides an API for managing private theatres, focusing on two main aspects:
- Users booking theatres
- Admins managing theatres and other resources
- Theatre browsing and details viewing
- Slot availability checking
- Addon browsing
- Order creation and management (booking theatres)
- User authentication and authorization
- Payment processing with Razorpay integration
- Theatre management (creation and modification)
- Slot management (creating new time slots)
- Addon management (creating and modifying addons)
- User management (creating new user accounts)
- Access to all orders and bookings
GET /healthz
: Check the health status of the API
POST /slots
: Create a new slot (Admin only)GET /slots
: Retrieve all slots
POST /theatres
: Create a new theatre (Admin only)GET /theatres
: Retrieve all theatresGET /theatres/{id}
: Get details of a specific theatre
POST /addons
: Create a new addon (Admin only)GET /addons
: Retrieve all addonsGET /addons/categories
: Get addon categories
POST /orders
: Create a new orderGET /orders
: Retrieve all ordersGET /orders/{orderId}
: Get details of a specific order
POST /users
: Create a new user (Admin only)POST /login
: User loginPOST /refresh-token
: Refresh authentication token
POST /verify-payment
: Verify payment status
- Go (Golang)
- Chi router
- Razorpay for payment processing
- Clone the repository
- Install dependencies:
go mod tidy
- Set up environment variables:
- Copy the
.env.example
file to.env
- Fill in the required values in the
.env
file
- Copy the
- Run the application:
- For development with auto-reload:
air
- For production:
go run main.go
- For development with auto-reload:
This project uses environment variables for configuration. Please refer to the .env.example
file in the repository for the required variables. Make sure to set these up before running the application.
Key variables include database connection details, Razorpay API keys, JWT configuration, and server settings. Ensure all variables are properly set, especially sensitive information like database credentials and API keys.
This project uses Air for live reloading during development. To use Air:
- Install Air:
go install github.com/cosmtrek/air@latest
- Run the application with:
air
Air will watch for file changes and automatically rebuild and restart the application.
The application uses token-based authentication. Some endpoints require admin authorization, which is handled by the AdminAuthorization
middleware. This ensures that only authorized admin users can access and modify sensitive data or perform administrative actions.
This project is licensed under the MIT License.