A simple backend service in Go for managing movies, showtimes and seat reservations.
- User signup, login and role-based access via JWT
- CRUD operations for movies (admin only)
- CRUD operations for showtimes (admin only)
- List movies and their showtimes
- Check available seats and make/cancel reservations
- Go 1.21 or higher
- PostgreSQL database
- Clone the repository:
git clone <repository-url> cd ticketmonster
- Copy
.env.exampleto.envand update settings. - Install dependencies:
go mod tidy
- Start the application locally:
go run cmd/main.go
The server listens by default on :8080.
To run both the API and a PostgreSQL database with Docker:
docker-compose up -dThis will build the Go binary, start the service on port 8080,
and spin up Postgres on port 5432 (database movie_reservation is created automatically).
To connect to the DB container or recreate the database manually:
docker-compose exec db createdb --username=postgres movie_reservationStop and remove containers:
docker-compose downPublic
Method Endpoint Description POST /api/signupRegister a new user POST /api/loginAuthenticate user GET /api/moviesList all movies User (authenticated)
Method Endpoint Description GET /api/user/reservationsList current user's reservations POST /api/reservationsCreate a new reservation DELETE /api/reservations/:reservationIdCancel a reservation GET /api/showtimes/:showtimeId/seatsGet available seats GET /api/movies/:movieID/showtimesList showtimes for a movie Admin
Method Endpoint Description POST /api/admin/moviesCreate a movie PUT /api/admin/movies/:movieIdUpdate a movie DELETE /api/admin/movies/:movieIdDelete a movie GET /api/admin/reservationsList all reservations POST /api/admin/users/:userId/promotePromote a user to admin POST /api/admin/showtimesCreate a showtime PUT /api/admin/showtimes/:showtimeIdUpdate a showtime DELETE /api/admin/showtimes/:showtimeIdDelete a showtime