Skip to content

A code challenge using DJango, Stripe API and HTMX - A proof of concept project with production readiness in mind

Notifications You must be signed in to change notification settings

Falamarcao/sofia-health-engineering-assessment

Repository files navigation

Sofia Health Appointment Booking System (Software Engineering Code Challenge)

A minimal Django project for booking appointments with Stripe payment integration.

Features

  • Async Django views for I/O-bound operations
  • Stripe payment integration with idempotency support
  • HTMX-powered frontend with DaisyUI styling
  • YAML-based configuration using Dynaconf
  • ASGI support for async operations

Setup

  1. Install dependencies:

    uv sync
  2. Create a sofia_health/.secrets.yaml file with your Stripe API keys:

    1. Create a copy of the template:

      cp ./sofia_health/.secrets.yaml.template ./sofia_health/.secrets.yaml
    2. Add your Stripe API keys (⚠️USE TEST KEYS⚠️): sofia_health/.secrets.yaml

      Stripe Configuration

      To test payments, you need to obtain test API keys from Stripe:

      1. Go to https://dashboard.stripe.com/test/apikeys
      2. Copy your publishable key (pk_test_...) and secret key (sk_test_...)
      3. Update .secrets.yaml with your keys.

      When using real keys (prod, staging), remember to use secret vault services.

  3. Run migrations:

    uv run manage migrate
  4. Run server:

    uv run server --port 8000 --open-browser
  5. Access the application:

    http://localhost:8000 http://localhost:8000/admin

Configuration

Uses Dynaconf with YAML files:

  • settings.yaml - Non-sensitive configuration
  • .secrets.yaml - Secrets (not committed to version control)

Environment-specific settings:

  • default - Default settings
  • development - Development environment settings

Static Files

Static files are configured with Dynaconf and served with WhiteNoise:

  • STATIC_URL - URL to serve static files
  • STATIC_ROOT - Directory where static files are collected for production
  • STATICFILES_STORAGE - Storage backend for static files

In development, static files are served automatically by Django with WhiteNoise. In production, you should run collectstatic and WhiteNoise will serve the collected static files.

Scalability

For thousands of bookings/day:

  1. Find a state of art Django production ready solution for reference
    1. Production checklist
    2. Architecture.
    3. Why? People are doing the same things for years without searching before defining an architecture.
  2. Change Dabatase to a managed service on some cloud provider (eg. AWS RDS Aurora)
  3. Setup a monitoring service for KPI and alerting.
  4. Study the performance of the system and identify bottlenecks.
  5. Check how serve static files in production using Django.
    1. The more efficient way with zero or low cost.
  6. Use a task queue (eg. Celery, Rabbitmq, Kafka).
  7. Setup a cache service on Django (eg. Redi, Dragonfly) (only if strictly necessary).

Founder Communication

Simple way: Open discussions on the project like we have in Github discussions. Link the Kanban board: - Link the table genearated by https://github.com/MrLesk/Backlog.md. - Or use Jira, AzureDevops. Explain discoveries, moves and blockers. Talk like humans on the conversation thread. Keep it asynchronous, and talk on Google Meet before releases.

About

A code challenge using DJango, Stripe API and HTMX - A proof of concept project with production readiness in mind

Resources

Stars

Watchers

Forks