How arthurpc03/newgobarber works
GoBarber is an appointment-scheduling API for customers and service providers. Its HTTP server exposes user registration, authentication, profile/avatar management, provider discovery, appointment booking, and provider appointment/availability views. Appointment services depend on repositories and TypeORM-backed entities; user authentication also uses a hash provider. The README documents provider appointment management and cancellation visibility, though the available tree shows no cancellation-specific component. Several implementation links are omitted because source excerpts do not establish their callers.
Main entry points: users.routes.ts User routes · index.ts Route registry · providers.routes.ts Provider routes · services Appointment services
Components 28
HTTP API
- Express server
src/shared/infra/http/server.ts - Route registry
src/shared/infra/http/routes/index.ts - Appointment routes
src/modules/appointments/infra/http/routes/appointments.routes.ts - Provider routes
src/modules/appointments/infra/http/routes/providers.routes.ts - User routes
src/modules/users/infra/http/routes/users.routes.ts - Profile routes
src/modules/users/infra/http/routes/profile.routes.ts
Scheduling
- Book appointment
src/modules/appointments/infra/http/controllers/AppointmentsController.ts - Provider appointments
src/modules/appointments/infra/http/controllers/ProviderAppointmentsController.ts - Availability lookup
src/modules/appointments/infra/http/controllers/ProviderDayAvailabilityController.ts - Monthly availability
src/modules/appointments/infra/http/controllers/ProviderMonthAvailabilityController.ts - Provider discovery
src/modules/appointments/infra/http/controllers/ProvidersController.ts - Appointment services
src/modules/appointments/services
Accounts
- User registration
src/modules/users/infra/http/controllers/UsersController.ts - Authentication
src/modules/users/infra/http/controllers/SessionsController.ts - Profile management
src/modules/users/infra/http/controllers/ProfileController.ts - Avatar management
src/modules/users/infra/http/controllers/UserAvatarController.ts - Authentication guard
src/modules/users/infra/http/middlewares/ensureAuthenticated.ts - Account services
src/modules/users/services
Persistence and providers
- Appointment repository
src/modules/appointments/infra/typeorm/repositories/AppoitmentsRepository.ts - Appointment records
src/modules/appointments/infra/typeorm/entities/Appointment.ts - User repository
src/modules/users/infra/typeorm/repositories/UsersRepository.ts - User records
src/modules/users/infra/typeorm/entities/User.ts - Password hashing
src/modules/users/providers/HashProvider/implementations/BCryptHashProvider.ts - File storage
src/shared/container/providers/StorageProvider - Notifications
src/modules/notifications/infra/typeorm/repositories/NotificationsRepository.ts - Notification records
src/modules/notifications/infra/typeorm/schemas/Notification.ts
Other components
- Customer
- Service provider
Connections 33
- Express server → Route registry: mounts routes
src/shared/infra/http/server.ts - Route registry → Appointment routes: registers
- Route registry → Provider routes: registers
- Route registry → User routes: registers
- Route registry → Profile routes: registers
- Customer → Appointment routes: requests booking
- Appointment routes → Book appointment: routes to
src/modules/appointments/infra/http/routes/appointments.routes.ts - Service provider → Provider routes: requests schedules
src/modules/appointments/infra/http/routes/providers.routes.ts - Provider routes → Provider discovery: routes to
src/modules/appointments/infra/http/routes/providers.routes.ts - Provider routes → Availability lookup: routes to
src/modules/appointments/infra/http/routes/providers.routes.ts - Provider routes → Monthly availability: routes to
src/modules/appointments/infra/http/routes/providers.routes.ts - Appointment routes → Provider appointments: routes to
src/modules/appointments/infra/http/routes/appointments.routes.ts - Book appointment → Appointment services: invokes
- Provider appointments → Appointment services: invokes
src/modules/appointments/infra/http/controllers/ProviderAppointmentsController.ts - Availability lookup → Appointment services: invokes
src/modules/appointments/infra/http/controllers/ProviderDayAvailabilityController.ts - Appointment services → Appointment repository: uses
- Appointment repository → Appointment records: persists
- Customer → User routes: registers account
src/modules/users/infra/http/routes/users.routes.ts - User routes → User registration: routes to
src/modules/users/infra/http/routes/users.routes.ts - Profile routes → Profile management: routes to
src/modules/users/infra/http/routes/profile.routes.ts - Profile routes → Authentication guard: guards access
src/modules/users/infra/http/routes/profile.routes.ts - User routes → Avatar management: routes to
src/modules/users/infra/http/routes/users.routes.ts - User routes → Authentication guard: guards avatar
src/modules/users/infra/http/routes/users.routes.ts - User routes → Authentication: routes to
- User registration → Account services: invokes
- Profile management → Account services: resolves services
src/modules/users/infra/http/controllers/ProfileController.ts - Authentication → Account services: invokes
- Account services → User repository: uses
- User repository → User records: reads and writes
- Account services → Password hashing: checks passwords
src/modules/users/services/AuthenticateUserService.ts - Avatar management → File storage: stores avatar
- Appointment services → Notifications: notifies
- Notifications → Notification records: stores