user-api.json. Save it somewhere you can find it easily (like your Desktop).user-api.json file into Cursor's file explorer. It should appear in the sidebar.Cmd+I (Mac) or Ctrl+I (Windows/Linux). This opens Composer mode, which can generate entire projects.I have an OpenAPI 3.0 specification in user-api.json. Generate a complete, production-ready Python FastAPI project that implements this spec exactly.
TECH STACK:
- FastAPI (web framework)
- SQLAlchemy (ORM)
- SQLite for development (easy PostgreSQL migration later)
- JWT authentication (python-jose)
- Password hashing (passlib with bcrypt)
- Pydantic v2 (validation)
- Uvicorn (ASGI server)
REQUIREMENTS:
1. Implement ALL endpoints from the OpenAPI spec
2. Request/response formats must match the spec exactly
3. All HTTP status codes as specified
4. JWT token generation and validation
5. Password hashing (never store plain text)
6. Proper error handling with meaningful messages
7. Input validation matching the schemas
8. CORS enabled for local development
9. Clear code comments explaining key parts
PROJECT STRUCTURE:
IMPORTANT DETAILS:
- Email must be unique (database constraint)
- Password field is write-only (never return it)
- Protected endpoints require valid JWT in Authorization header
- User can only modify/delete their own account
- Tokens expire after 24 hours
- createdAt and updatedAt timestamps auto-managed
- All string inputs trimmed
- Proper HTTP status codes (200, 201, 204, 400, 401, 403, 404, 422)
Generate all files with complete, working code. Make sure it can run immediately after pip install.Ctrl+` (backtick key, usually above Tab). This opens a terminal at the bottom of Cursor.(venv) appear at the start of your terminal prompt.INFO: Uvicorn running on http://127.0.0.1:8000
INFO: Application startup complete.http://localhost:8000/docspip install -r requirements.txt againuvicorn main:app --reload --port 8001