Skip to content

md84/aurora

Repository files navigation

Aurora — Plataforma SaaS de Gestão em Saúde

CI/CD PR Check

Uma nova era na gestão em saúde

Aurora is a multi-tenant SaaS platform for Brazilian healthcare clinics and medical practices. It covers scheduling, electronic medical records (prontuário), billing, telemedicine, patient portal, WhatsApp notifications, and more.


Stack

Layer Technology
Frontend React 19 + Vite + TypeScript
Backend Python 3.12 + FastAPI + SQLAlchemy 2.0 (async)
Database PostgreSQL (Supabase) — schema aurora
Cache Redis
Reverse Proxy Caddy
Container Docker Compose

Local Development Setup

Prerequisites

  • Docker + Docker Compose
  • Node.js 20+
  • Python 3.12+
  • A Supabase project (or local Supabase via supabase start)

1. Clone and configure environment

git clone https://github.com/md84/aurora.git
cd aurora
cp api/.env.example api/.env
# Edit api/.env with your real values (see Variables section below)

2. Start the backend

cd api
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8019

3. Start the frontend

cd web
npm install
npm run dev
# Opens on http://localhost:5173

4. Run with Docker Compose (recommended)

cd /opt/stacks/aurora   # or your local stack dir
docker compose up -d

Services started:

Container Port URL
aurora-api 8019 http://localhost:8019
aurora-web 8016 http://localhost:8016
aurora-lp 8017 http://localhost:8017
aurora-lp-invest 8018 http://localhost:8018

Required Environment Variables

Create api/.env from the template below:

# Database
DATABASE_URL=postgresql+asyncpg://user:pass@host:5432/db
REDIS_URL=redis://localhost:6379

# Supabase
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=...
SUPABASE_SERVICE_ROLE_KEY=...
SUPABASE_JWT_SECRET=...

# Security
SECRET_KEY=<32+ char random string>
FERNET_KEY=<Fernet.generate_key() output>
ENCRYPTION_KEY=<32 char string>

# WhatsApp (Evolution API)
EVOLUTION_API_URL=https://your-evolution-api.com
EVOLUTION_API_KEY=...
EVOLUTION_INSTANCE=aurora

# Telemedicine
DAILY_API_KEY=...

# Email
RESEND_API_KEY=...

# NFS-e (Focus NFe)
FOCUS_NFE_KEY=...
FOCUS_NFE_AMBIENTE=homologacao   # or producao

# Sentry (optional)
SENTRY_DSN=...

Running Tests

cd api
# Unit + integration tests (no external services)
pytest tests/ -v --ignore=tests/test_integrations_e2e.py

# With coverage report
pytest tests/ --cov=app --cov-report=term-missing --ignore=tests/test_integrations_e2e.py

# E2E tests (requires real services in .env)
pytest tests/test_integrations_e2e.py -v

Linting

cd api
pip install ruff
ruff check . --select E,W,F --ignore E501

Database Migrations

Migrations are plain SQL files in api/migrations/ numbered sequentially (001_*.sql, 002_*.sql, …).

Apply all pending migrations:

# Against your Supabase project (psql)
for f in api/migrations/*.sql; do
  psql "$DATABASE_URL" -f "$f"
done

Current applied migrations: 001 through 010 (see api/migrations/ for details).


Deploy Instructions

Manual deploy (API)

rsync -av --delete /root/aurora/api/ /opt/stacks/aurora/api/ \
  --exclude='__pycache__' --exclude='*.pyc'
cd /opt/stacks/aurora
docker compose up -d --build aurora-api

Manual deploy (Web)

rsync -av /root/aurora/web/src/ /opt/stacks/aurora/web/src/
cd /opt/stacks/aurora
docker compose up -d --build aurora-web

Automated deploy via CI/CD

Every push to main that passes all CI jobs triggers the deploy webhook at https://deploy.aurora.hydrocore.com.br/webhook. The webhook runs the rsync + docker compose steps on the VPS automatically.

Required GitHub secrets:

Secret Purpose
DEPLOY_WEBHOOK_SECRET HMAC key for webhook signature verification
FERNET_KEY_CI Fernet key used in CI test environment

CI/CD Pipeline

push to main/develop
        │
        ├── test-backend   (pytest + coverage)
        ├── lint-backend   (ruff)
        └── test-frontend  (tsc + vite build)
                │
                └── deploy (webhook) ← only on main push, all jobs green

Pull request checks (fast, no deploy):

open PR → lint-backend + typecheck-frontend

Architecture Overview

caddy (reverse proxy)
  ├── api.aurora.hydrocore.com.br  → aurora-api:8019  (FastAPI)
  ├── aurora.hydrocore.com.br      → aurora-web:8016  (React SPA)
  ├── lpaurora.hydrocore.com.br    → aurora-lp:8017   (Landing Page)
  └── lpaurorainvest.hydrocore.com.br → aurora-lp-invest:8018

aurora-api
  ├── PostgreSQL (Supabase, schema: aurora)
  ├── Redis (cache + job queue)
  └── External: Evolution API, Daily.co, Focus NFe, Resend, Stripe

Project Status

24 of 33 phases implemented. Key pending phases:

  • Phase 11 — Landing Page (Next.js / standalone)
  • Phase 13 — Stripe Subscriptions (full billing)
  • Phase 14 — Transactional Emails (React Email templates)
  • Phase 17 — Observability (Sentry dashboards, alerting)
  • Phase 23 — TISS & Health Insurance Claims
  • Phase 27 — Native PIX payments

See docs/PROMPT_DETALHADO_v5.md and docs/PROMPT_MESTRE_v6.md for the full specification.


License

Proprietary — Hydrocore Tecnologia. All rights reserved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors