https://github.com/layinded/swx-api
SwX is a modular, full-featured FastAPI starter template designed for building scalable, secure, and production-ready backend or full-stack applications with ease.
https://github.com/layinded/swx-api
alembic api backend boilderplate devtools fastapi fastapi-crud jwt modular-architecture oauth2 postgres postgresql production-ready python sqlalchemy sqlmodel template
Last synced: 3 months ago
JSON representation
SwX is a modular, full-featured FastAPI starter template designed for building scalable, secure, and production-ready backend or full-stack applications with ease.
- Host: GitHub
- URL: https://github.com/layinded/swx-api
- Owner: layinded
- License: mit
- Created: 2025-03-21T05:35:48.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2025-03-21T06:27:32.000Z (3 months ago)
- Last Synced: 2025-03-21T06:29:19.816Z (3 months ago)
- Topics: alembic, api, backend, boilderplate, devtools, fastapi, fastapi-crud, jwt, modular-architecture, oauth2, postgres, postgresql, production-ready, python, sqlalchemy, sqlmodel, template
- Language: Python
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ SwX-API


[](./LICENSE)


**SwX-API** is a Laravel-style, API-first **FastAPI** framework designed for speed, scalability, and maintainability. With a modular architecture, robust authentication (OAuth2, JWT, and social login), and production-grade tooling, it offers everything you need to kickstart your backend project.
> Built with โค๏ธ for developers who value flexibility and structure.
---
## โจ Features
- โก **FastAPI** backend with modular folder structure (`core/`, `app/`)
- ๐๏ธ **SQLModel** ORM with **PostgreSQL** support
- ๐ **Alembic** migrations with auto-generation
- ๐ **OAuth2 + JWT** authentication with refresh tokens
- ๐ฅ **Social login** support (Google, Facebook)
- ๐ก๏ธ **Role-Based Access Control (RBAC)** & superuser support
- ๐ **i18n** with language preference detection
- ๐ง **Dynamic model loading** & multilingual data seeding
- ๐ ๏ธ **CLI Tool**: `swx` for scaffolding and automation
_(e.g., `swx make:resource`, `swx migrate`)_
- ๐ **MkDocs** auto-generated API docs from Python docstrings
- ๐งช Pre-configured **logging**, **linting**, **formatting**, and **testing**
- ๐ณ **Docker-ready** with `docker-compose.yml`
- โ๏ธ Optional integration with **Traefik**, **Sentry**, and **GitHub Actions**
- ๐ **CI/CD**-friendly with production-grade deployment tools---
## ๐ Project Structure
```bash
swx_api/
โโโ app/ # User-defined application logic (routes, services)
โโโ core/ # Core framework logic (auth, db, utils, etc.)
โโโ docs/ # MkDocs documentation
โโโ alembic/ # Alembic migrations
โโโ scripts/ # CLI scripts
โโโ Dockerfile # Docker configuration
โโโ docker-compose.yml # Base Compose config
โโโ ...```
### ๐ ๏ธ Installation### Prerequisites
- Python 3.10+
- Docker & Docker Compose (optional)
- PostgreSQL### ๐ฆ Clone the Repository
```bash
git clone https://github.com/yourusername/swx-api.git
cd swx-api
```### ๐ Create a Virtual Environment
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```### ๐ฅ Install Dependencies
```bash
pip install -r requirements.txt
```### โ๏ธ Configure Environment Variables
Create a `.env` file in the project root with the following content:
```env
DATABASE_URL=postgresql+psycopg2://user:password@localhost:5432/swx_db
JWT_SECRET_KEY=your_jwt_secret
```> Replace `user`, `password`, and `swx_db` with your actual PostgreSQL credentials and database name.
### ๐ Run Database Migrations
```bash
swx migrate
```### ๐ Start the Development Server
```bash
uvicorn main:app --reload
```---
### ๐ณ Run with Docker (Optional)
If you prefer using Docker:
```bash
docker-compose up --build
```> This will spin up the app along with PostgreSQL using the provided `docker-compose.yml`.
---
## Deployment
Deployment docs: [deployment.md](./deployment.md).
## Development
General development docs: [development.md](./development.md).
This includes using Docker Compose, custom local domains, `.env` configurations, etc.