A social reading and writing platform that enables readers to discover, read, and interact with books and chapters while providing writers with tools to publish, monetize, and build communities around their stories.
- Next.js 14 (App Router) with TypeScript
- ShadCN UI + Tailwind CSS
- React Query (TanStack Query) for data fetching
- NextAuth.js for authentication
- React Hook Form + Zod for forms
- Python 3.11+ with FastAPI
- SQLAlchemy ORM with Alembic migrations
- SQLite (development) / PostgreSQL (production)
- Redis for caching and sessions
- JWT for authentication
- Stripe for payment processing
- Cloudinary for media storage
- ElevenLabs for AI audio generation
legato/
├── frontend/ # Next.js frontend application
├── backend/ # FastAPI backend application
├── package.json # Root package.json for development scripts
└── README.md # This file
- Node.js 18+ and npm
- Python 3.11+
- Git
-
Clone and install dependencies:
git clone <repository-url> cd legato npm run install:all
-
Set up environment variables:
# Backend cp backend/.env.example backend/.env # Edit backend/.env with your configuration # Frontend cp frontend/.env.local.example frontend/.env.local # Edit frontend/.env.local with your configuration
-
Initialize the database:
cd backend # Activate virtual environment source venv/bin/activate # On Windows: venv\Scripts\activate # Run initial migration alembic upgrade head
-
Start development servers:
# From root directory npm run devThis will start:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Frontend only:
npm run dev:frontendBackend only:
npm run dev:backendGET /health- API health checkGET /api/v1/health- API v1 health check
POST /api/v1/auth/register- User registrationPOST /api/v1/auth/login- User login
GET /api/v1/users/profile- Get user profilePUT /api/v1/users/profile- Update user profile
GET /api/v1/books- List books with filtersPOST /api/v1/books- Create new bookGET /api/v1/books/{id}- Get book details
Frontend:
cd frontend
npm install <package-name>Backend:
cd backend
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install <package-name>
pip freeze > requirements.txtCreate new migration:
cd backend
alembic revision --autogenerate -m "Description of changes"Apply migrations:
alembic upgrade headThe project uses:
- ESLint and TypeScript for frontend code quality
- Python type hints and proper imports for backend
- Consistent code formatting
DATABASE_URL=sqlite:///./legato.db
REDIS_URL=redis://localhost:6379
SECRET_KEY=your-secret-key
ALLOWED_HOSTS=["http://localhost:3000"]
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-nextauth-secret
- Create a feature branch from main
- Make your changes
- Test your changes locally
- Submit a pull request
[Add your license information here]