Checklist / README.md
Ali2206's picture
Deploy FastAPI backend with MongoDB integration - Added app.py, requirements.txt, and updated Dockerfile for HF Spaces deployment
b19e5b5
metadata
title: Audit Checklist API
emoji: 📋
colorFrom: blue
colorTo: green
sdk: docker
pinned: false
license: mit
app_port: 8000

Audit Checklist FastAPI Backend

This is the backend API for the Audit Checklist React Native application.

Features

  • MongoDB Atlas integration
  • REST API endpoints for audit checklists
  • CORS support for mobile apps
  • Health check endpoint
  • User session management
  • Comprehensive error handling

API Endpoints

Health Check

  • GET / - Basic health check
  • GET /health - Detailed health information

Checklist Management

  • GET /api/checklist/{user_id} - Get checklist for user
  • PUT /api/checklist/{user_id} - Save/update checklist
  • GET /api/checklists - Get all checklists (admin)
  • GET /api/checklists/by-user/{user_name} - Get checklists by user name

Server Information

  • GET /api/server-info - Get server information

Environment Variables

Set these in your Hugging Face Space settings:

  • MONGODB_URI: Your MongoDB Atlas connection string
  • CORS_ORIGIN: Frontend URL (optional, defaults to allow all)

Data Structure

The API manages audit checklists with the following structure:

{
  "userId": "user-1234567890",
  "title": "Checklist di Audit Operativo (38 Controlli)",
  "sections": [...],
  "metadata": {
    "userName": "John Doe",
    "savedAt": "2024-01-15T14:30:25.123Z",
    "savedAtFormatted": "15/01/2024, 14:30:25",
    "userId": "user-1234567890",
    "version": "1.0"
  }
}

Usage

This API is designed to work with the Audit Checklist React Native mobile application. The mobile app sends audit data to this backend, which stores it in MongoDB Atlas with user information and timestamps.

Deployment

This FastAPI application is deployed on Hugging Face Spaces using Docker. The application runs on port 8000 and is accessible at:

https://ali2206-checklist.hf.space

Development

To run locally:

cd server
pip install -r requirements.txt
python start_server.py

The API will be available at http://localhost:5000