GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - selamet/letsraffle-api: A simple and secure raffle platform with instant result generation

BranchesTags
Open more actions menu

Latest commit

 

History

215 Commits
215 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
alembic
alembic
 
 
app
app
 
 
scripts
scripts
 
 
tests
tests
 
 
.coveragerc
.coveragerc
 
 
.dockerignore
.dockerignore
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
alembic.ini
alembic.ini
 
 
docker-compose.prod.yml
docker-compose.prod.yml
 
 
docker-compose.yml
docker-compose.yml
 
 
docker-entrypoint.sh
docker-entrypoint.sh
 
 
pytest.ini
pytest.ini
 
 
requirements.txt
requirements.txt
 
 

Repository files navigation

Santa's Draw - Secret Santa API

FastAPI-based RESTful API project for Secret Santa draw management.

Features

  • šŸ” User authentication and authorization
  • šŸŽ² Draw creation and management
  • šŸ‘„ Participant addition and removal
  • šŸŽ Automatic matching algorithm
  • šŸ“§ Email notifications
  • šŸ”„ Versioned API (v1)

Technologies

  • FastAPI 0.120.0 - Modern web framework
  • Pydantic 2.12.3 - Data validation
  • Python 3.13
  • Uvicorn - ASGI server
  • SQLAlchemy 2.0.36 - ORM
  • PostgreSQL - Database
  • Alembic 1.14.0 - Database migrations

Quick Start

# Clone the repository
git clone <repository-url>
cd santas_draw

# Copy environment file
cp .env.example .env

# Start all services
docker-compose up -d

# That's it! Application is running at http://localhost:8000
# API Docs: http://localhost:8000/docs

Admin Panel

A read-only panel at /admin shows draws, participants, match results and users. It is switched off (every /admin URL answers 404) until both settings below are set and SECRET_KEY has been changed from its default value.

# 1. Print the .env line for your password
python -m scripts.hash_admin_password

# 2. Add to .env (keep the single quotes around the hash)
[email protected]
ADMIN_PASSWORD_HASH='$2b$12$...'
  • Locally over plain http also set ADMIN_COOKIE_SECURE=false, otherwise the browser drops the session cookie.
  • In production the reverse proxy must forward /admin (including /admin/static) to the app, not only /api.
  • The panel never writes to the database, and its session cannot be used against the user API.

Prerequisites

  • Docker & Docker Compose

No Python, PostgreSQL, or other dependencies needed!

Available Commands

# Start all services
docker-compose up -d

# Stop all services
docker-compose down

# View logs
docker-compose logs -f

# View application logs only
docker-compose logs -f app

# View database logs only
docker-compose logs -f postgres

# Rebuild and start
docker-compose up -d --build

# Stop and remove volumes
docker-compose down -v

Configuration

The application uses environment variables loaded from .env file. Key settings:

  • APP_NAME - Application name
  • APP_VERSION - Application version
  • DEBUG - Debug mode (True/False)
  • API_VERSION - API version
  • HOST - Server host
  • PORT - Server port
  • CORS_ORIGINS - CORS allowed origins
  • DATABASE_URL - PostgreSQL connection string
  • DATABASE_ECHO - Log SQL queries (True/False)
  • DATABASE_POOL_SIZE - Connection pool size
  • DATABASE_MAX_OVERFLOW - Max overflow connections

E-mails

When Who Template
Names are drawn every participant email-template-{tr,en}.html
Someone joins a draw that participant join-confirmation.html
An invite draw is created the organizer draw-created.html
24 hours before a scheduled draw the organizer draw-reminder.html
A scheduled draw cannot run (fewer than 3 participants) the organizer, once draw-not-run.html
Password reset requested the user reset-password-template-{tr,en}.html

All of them are sent from Celery tasks, so a mail problem never fails the request that caused it.

Push notifications

When Who
Names are drawn participants
Someone joins the organizer: right away for the first join, then at most one summary per hour
24 hours before a scheduled draw organizer and participants
A scheduled draw cannot run (fewer than 3 participants) the organizer, once

Announcement e-mails

Campaign e-mails (for example the 2027 launch announcement) are sent with a script, never automatically:

python -m scripts.send_announcement                      # dry run: recipient counts only
python -m scripts.send_announcement --to [email protected]  # one test e-mail
python -m scripts.send_announcement --apply              # send to every registered user

Every e-mail carries a personal unsubscribe link (/api/v1/email/unsubscribe) and one-click List-Unsubscribe headers. Unsubscribed addresses are skipped, and sent addresses are recorded so the script can be re-run safely. API_URL must be the public URL of the API in production.

API Documentation

After running the application:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Project Structure

app/
ā”œā”€ā”€ main.py          # Main application
ā”œā”€ā”€ models/          # Database models
ā”œā”€ā”€ schemas/         # Pydantic schemas
ā”œā”€ā”€ api/
│   ā”œā”€ā”€ deps.py      # Dependency injection
│   └── v1/          # API endpoints
ā”œā”€ā”€ config/          # Configuration
└── tasks/           # Background tasks

License

AGPL v3 - See LICENSE file for details.

About

A simple and secure raffle platform with instant result generation

www.letsraffle.co

Topics

apibackendcelerydockerdrawing-systemfastapiflowerpythonraffle-systemredisrest-apitask-queue-worker

Resources

Readme
AGPL-3.0 license
Activity

Stars

29 stars

Watchers

1 watching

Forks

5 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800Ɨ600. No cookies required.