Architecture & Infrastructure
1. System Architecture
Skin Club Pro uses a microservices architecture built with NestJS and React.
Core Services
- Auth Service (4000): Identity, JWT issuance, and JWKS provider.
- Clinic Service (3001): Core business logic, bookings, and patient records.
- CMS Service (4003): Content management for brochure sites and blogs.
- Notification Service (4002): Background worker for email and SMS.
- Payment Service (3006): Integration with Stripe, Square, and PayPal.
Communication
- Synchronous: REST APIs between Frontend and Services.
- Asynchronous: Redis/BullMQ for cross-service jobs (e.g., sending emails).
2. Infrastructure (AWS)
The platform is deployed using AWS CDK (Cloud Development Kit).
Key Components
- Compute: ECS Fargate for running Dockerized services.
- Database: RDS PostgreSQL (Multi-AZ for production).
- Caching/Queues: ElastiCache Redis.
- CDN/Routing: CloudFront with CloudFront Functions for multi-tenant routing.
- Storage: S3 for media assets and static site hosting.
- Secrets: AWS Secrets Manager for environment variables and API keys.
3. Site Provisioning (SaaS Manager)
We use a "Zero-Touch" provisioning model:
- Wildcard DNS:
*.practitioners.skinclubpro.compoints to CloudFront. - Edge Routing: A CloudFront Function extracts the subdomain and passes it to the Brochure Service.
- Dynamic Rendering: The service fetches the theme and content from the database based on the subdomain.
4. Deployment Strategy
- Staging: Automatic deployment to the staging environment on merge to
develop. - Production: Manual approval/tagging for deployment to production from
main. - CI/CD: GitHub Actions handles building Docker images, running tests, and deploying CDK stacks.