{"id":25426751,"url":"https://github.com/raythurman2386/fastapi-react-starter","last_synced_at":"2025-05-14T05:15:25.593Z","repository":{"id":277275592,"uuid":"931909149","full_name":"raythurman2386/fastapi-react-starter","owner":"raythurman2386","description":"A modern, minimal starter template featuring FastAPI backend and React 19 frontend with Tailwind CSS.","archived":false,"fork":false,"pushed_at":"2025-02-13T04:02:54.000Z","size":0,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T04:28:00.947Z","etag":null,"topics":["fastapi","react","tailwindcss","vite"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raythurman2386.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-13T03:45:55.000Z","updated_at":"2025-02-13T04:24:15.000Z","dependencies_parsed_at":"2025-02-15T23:31:20.185Z","dependency_job_id":null,"html_url":"https://github.com/raythurman2386/fastapi-react-starter","commit_stats":null,"previous_names":["raythurman2386/fastapi-react-starter"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raythurman2386%2Ffastapi-react-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raythurman2386%2Ffastapi-react-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raythurman2386%2Ffastapi-react-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raythurman2386%2Ffastapi-react-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raythurman2386","download_url":"https://codeload.github.com/raythurman2386/fastapi-react-starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239214042,"owners_count":19601075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","react","tailwindcss","vite"],"created_at":"2025-02-17T00:21:45.497Z","updated_at":"2025-05-14T05:15:25.573Z","avatar_url":"https://github.com/raythurman2386.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI React Starter Template\n\nA modern, full-featured starter template featuring FastAPI backend and React 19 frontend with TypeScript, Tailwind CSS, and shadcn/ui components.\n\n## Features\n\n- **Backend (FastAPI)**\n\n  - Fast and modern Python web framework\n  - PostgreSQL/SQLite database with async SQLAlchemy ORM\n  - JWT-based authentication system\n  - Role-based access control\n  - Async database operations\n  - Proper connection pooling and cleanup\n  - Environment configuration with pydantic\n  - Structured logging\n  - Health check endpoint\n  - Graceful shutdown handling\n  - Modular project structure\n\n- **Frontend (React 19)**\n  - Latest React features including `use` hook\n  - TypeScript for type safety and better developer experience\n  - React Router 7 for client-side routing\n  - shadcn/ui components for beautiful, accessible UI\n  - Component-based architecture\n  - Custom hooks for data fetching\n  - Modern error handling with Error Boundaries\n  - Suspense for loading states\n  - Tailwind CSS for styling\n  - Environment configuration\n  - Vite for fast development\n\n## Project Structure\n\n```\nfastapi-react-starter/\n├── backend/\n│   ├── app/\n│   │   ├── __init__.py\n│   │   ├── main.py              # FastAPI application entry\n│   │   ├── config/              # Configuration management\n│   │   │   ├── __init__.py\n│   │   │   └── config.py        # Environment settings\n│   │   ├── db/                  # Database\n│   │   │   ├── __init__.py\n│   │   │   ├── database.py      # Database connection\n│   │   │   └── models.py        # SQLAlchemy models\n│   │   ├── routes/              # API routes\n│   │   │   ├── __init__.py\n│   │   │   ├── auth.py         # Authentication endpoints\n│   │   │   └── health.py       # Health check endpoint\n│   │   ├── schemas/            # Pydantic models\n│   │   │   ├── __init__.py\n│   │   │   └── auth.py        # Authentication schemas\n│   │   ├── services/          # Business logic\n│   │   │   ├── __init__.py\n│   │   │   └── auth.py       # Authentication services\n│   │   └── utils/            # Utilities\n│   │       ├── __init__.py\n│   │       └── logger.py     # Logging configuration\n│   ├── .env                  # Environment variables\n│   └── requirements.txt      # Python dependencies\n├── frontend/\n│   ├── src/\n│   │   ├── components/       # Reusable UI components\n│   │   │   └── ui/          # shadcn/ui components\n│   │   │       ├── button.tsx\n│   │   │       ├── card.tsx\n│   │   │       └── status-dot.tsx\n│   │   ├── features/         # Feature modules\n│   │   │   ├── auth/        # Authentication feature\n│   │   │   │   ├── LoginForm.tsx\n│   │   │   │   └── RegisterForm.tsx\n│   │   │   └── health/      # Health check feature\n│   │   │       └── HealthStatus.tsx\n│   │   ├── hooks/           # Custom React hooks\n│   │   │   ├── useAuth.ts\n│   │   │   └── useHealthStatus.ts\n│   │   ├── layouts/         # Page layouts\n│   │   │   └── MainLayout.tsx\n│   │   ├── lib/             # Utility functions and configurations\n│   │   │   └── utils.ts\n│   │   ├── routes/          # Route components and configurations\n│   │   │   └── root.tsx\n│   │   ├── types/           # TypeScript type definitions\n│   │   │   └── index.d.ts\n│   │   └── App.tsx          # Main React component\n│   ├── .env                 # Frontend environment variables\n│   └── package.json         # Node.js dependencies\n└── README.md               # Project documentation\n```\n\n## Quick Start\n\n### Using Docker (Recommended)\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/raythurman2386/fastapi-react-starter.git\n   cd fastapi-react-starter\n   ```\n\n2. Create environment files:\n\n   Create `.env` file in the root directory:\n\n   ```env\n   # Database Configuration\n   DB_USER=postgres\n   DB_PASSWORD=postgres\n   DB_NAME=fastapi_db\n   ```\n\n3. Start the application with Docker:\n\n   ```bash\n   docker compose up --build\n   ```\n\n   This will:\n\n   - Start PostgreSQL database\n   - Reset the database (drop and recreate with fresh migrations)\n   - Start the FastAPI backend at http://localhost:8000\n   - Start the React frontend at http://localhost:5173\n\n   The Swagger docs will be available at http://localhost:8000/docs\n\n### Automated Setup Scripts\n\nFor your convenience, this project includes automated setup scripts for both Windows and Linux/Mac:\n\n#### Windows Setup\n\n1. Open PowerShell as Administrator\n2. Navigate to the project directory\n3. Run the setup script:\n   ```powershell\n   .\\setup.ps1\n   ```\n\nThis script will:\n\n- Check for required dependencies (Git, Python, Node.js)\n- Install pnpm if not already installed\n- Set up Git hooks for code formatting using pre-commit\n- Create and configure Python virtual environment for the backend\n- Install backend dependencies\n- Install frontend dependencies with pnpm\n- Set up environment variables\n\n#### Linux/Mac Setup\n\n1. Open a terminal\n2. Navigate to the project directory\n3. Make the script executable and run it:\n   ```bash\n   chmod +x setup.sh\n   ./setup.sh\n   ```\n\nThis script performs the same setup steps as the Windows version but is adapted for Unix-based systems.\n\n### Manual Setup (Alternative)\n\n1. Backend Setup:\n\n   a. Install PostgreSQL and create a database:\n\n   ```bash\n   # macOS with Homebrew\n   brew install postgresql\n   brew services start postgresql\n\n   # Create database\n   createdb fastapi_db\n   ```\n\n   b. Create a `.env` file in the backend directory:\n\n   ```env\n   # Database Configuration\n   DB_NAME=fastapi_db\n   DB_USER=postgres  # your database user\n   DB_PASSWORD=postgres  # your database password\n   DB_HOST=localhost\n   DB_PORT=5432\n   CORS_ORIGINS=[\"http://localhost:5173\"]\n   ENVIRONMENT=development\n   ```\n\n   c. Install Python dependencies and run migrations:\n\n   ```bash\n   cd backend\n   pip install -r requirements.txt\n   python manage.py reset_db  # This will reset the database and apply migrations\n   uvicorn app.main:app --reload\n   ```\n\n2. Frontend Setup:\n   ```bash\n   cd frontend\n   npm install\n   npm run dev\n   ```\n\n### Database Management\n\nThe project includes several database management commands:\n\n```bash\n# Reset the database (drop, recreate, and apply migrations)\npython manage.py reset_db\n\n# Generate new migrations\npython manage.py makemigrations \"description of changes\"\n\n# Apply pending migrations\npython manage.py migrate\n\n# Check migration status\npython manage.py db_status\n\n# Rollback last migration\npython manage.py downgrade\n```\n\nIf you encounter database errors:\n\n1. Stop all running services\n2. Reset the database using `python manage.py reset_db` or through Docker with `docker compose up --build`\n3. The database will be recreated with fresh tables\n\n### Troubleshooting\n\n1. Backend Status shows \"error\":\n\n   - Ensure PostgreSQL is running\n   - Check database credentials in `.env`\n   - Try resetting the database using `python manage.py reset_db`\n   - Check backend logs for specific error messages\n\n2. User Registration fails:\n   - Ensure the database is properly initialized\n   - Check if backend is running and accessible\n   - Verify CORS settings in backend `.env`\n   - Check browser console for specific error messages\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraythurman2386%2Ffastapi-react-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraythurman2386%2Ffastapi-react-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraythurman2386%2Ffastapi-react-starter/lists"}