Welcome to the Tattoo Studio API documentation. This robust API manages user authentication, appointment scheduling, and tattoo artist portfolios. It's the 4th project of the GeeksHub Academy Fullstack Bootcamp, showcasing real-world backend development skills with TypeScript and Express.
- Stack π οΈ
- Features π
- Live Deployment π‘
- Installation π
- API Documentation π
- Database Design π
- API Endpoints π
- Author βοΈ
- Roadmap π£οΈ
- Acknowledgements π
- User Authentication: Secure signup and login processes. π
- Appointment Creation: Users can book appointments, with date and user profile validation. π
- Tattoo Artist Portfolios: Tattooists can upload examples of their work. π¨
- Admin CRUD Endpoints: Full control over users, appointments, and tattoo works for administrators. π©βπΌπ¨βπΌ
- Swagger Documentation: Fully documented API endpoints. π
- Docker Compose: Easy setup and deployment with Docker. π³
- Google-Style JSON Responses: Consistently formatted responses. π
- MySQL Database with TypeORM and Migrations: Robust database management. ποΈ
- Mock Data Generation: Realistic data generation with Faker.js. π€
- JWT Authentication: Secure API endpoints with JSON Web Tokens. π
- Error Handling: Custom error middleware for handling common API errors. π
Try out the API at:
Get a copy of the project up and running on your local machine for development and testing purposes.
git clone https://github.com/pedrogardim/tattoo-booking-api.git
cd tattoo-booking-api
docker-compose up --build
(You'll need Docker and Docker Compose installed on your machine.)
npm install # Install dependecies
npm run migrations:run # Run migrations
npm run seed # Populate DB with mock
npm run dev # Run server
You'll need add a .env
based on the provided .env.example
file with the database credentials, and have a MySQL server running.
Access the Swagger documentation at:
- Development: http://localhost:3000/api-docs
- Production: https://tattoo-booking-api-production.up.railway.app/api-docs
Users
toAppointments
: Double one-to-many relationship where:- One user (as a client) can have many appointments.
- One user (as a tattooist) can be associated with many appointments.
Users
toTattoo Works
: One-to-many relationship where one tattooist can have many works
Users
table:- Unique constraint on
email
to ensure each user has a unique email address.
- Unique constraint on
Appointments
andTattoo Works
tables:- Foreign key constraint on
client_id
andtattooist_id
referring toid
in theUsers
table.
- Foreign key constraint on
Check the swagger documentation for a complete documentation of the API endpoints.
(Click to expand)
Documentation
GET /api-docs
- Swagger documentation.
User Endpoints
POST /api/auth/register
- Register a new user.POST /api/auth/login
- Login an existing user.
GET /api/users/me
- Retrieve authenticated user's profile.PUT /api/users/me
- Update authenticated user's profile.DELETE /api/users/me
- Delete authenticated user.GET /api/users/getTattooists
- List all tattooists.
GET /api/appointments/my
- Retrieve user's appointments.POST /api/appointments/my
- Request a new appointment.GET /api/appointments/my/{id}
- Retrieve details of a specific appointment.PUT /api/appointments/my/{id}
- Update a specific appointment.DELETE /api/appointments/my/{id}
- Delete a specific appointment.
GET /api/tattooWorks
- List all tattoo works.GET /api/tattooWorks/{id}
- Retrieve a specific tattoo work by ID.
GET /api/tattooWorks/my
- Retrieve a tattooist's works.POST /api/tattooWorks/my
- Create a new work for the authenticated tattooist.PUT /api/tattooWorks/my/{id}
- Update a specific tattoo work by ID.DELETE /api/tattooWorks/my/{id}
- Delete a specific tattoo work by ID.
Admin endpoints
GET /api/users
- List all users.POST /api/users
- Create a new user.GET /api/users/{id}
- Retrieve a user by ID.PUT /api/users/{id}
- Update a user by ID.DELETE /api/users/{id}
- Delete a user by ID.PUT /api/users/setAsTattooist/{id}
- Set a user as a tattooist.
GET /api/appointments
- List all appointments.POST /api/appointments
- Create a new appointment.GET /api/appointments/{id}
- Retrieve a specific appointment by ID.PUT /api/appointments/{id}
- Update a specific appointment by ID.DELETE /api/appointments/{id}
- Delete a specific appointment by ID.
POST /api/tattooWorks
- Create a new tattoo work.PUT /api/tattooWorks/{id}
- Update a tattoo work by ID.DELETE /api/tattooWorks/{id}
- Delete a tattoo work by ID.
- Add notifications - So users know when their appointments are modified, created or deleted.
- Add a React frontend - So users can interact with the API from a web browser.
- A big shoutout to the Geekshubs Academy for the opportunity to learn and grow as a developer.