-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathai.context
55 lines (48 loc) · 3.12 KB
/
ai.context
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# AI Context for Code Understanding and Generation
## Project Overview
This project is a music-related web application with both frontend and backend components. It uses FastAPI for the backend, SvelteKit for the frontend, and various APIs for music data. The application is designed to manage artists, albums, tracks, and user accounts, with features for authentication, caching, and rate limiting.
## Key Technologies
- Backend: FastAPI, SQLAlchemy, SQLModel, PostgreSQL (with asyncpg)
- Frontend: SvelteKit, TypeScript
- Authentication: JWT (using python-jose)
- Caching: Redis
- APIs: Soundcharts API, custom Music API
- Other: Tauri for desktop app capabilities, Clerk for authentication UI
## Important Concepts
1. Music Industry Data: The application manages artists, albums, tracks, genres, and subgenres.
2. Authentication: JWT-based authentication with refresh tokens.
3. API Integration: Multiple external APIs are used, including Soundcharts for artist analytics.
4. Database Models: SQLModel is used for defining database models and Pydantic schemas.
5. Caching: Redis is used for caching to improve performance.
6. Rate Limiting: Implemented to prevent API abuse.
7. Pagination: Used in API responses for large datasets.
8. Soft Delete: Implemented for data integrity and recovery.
## Code Structure
- Backend:
- Organized into apps (admin, auth, ms) with models, schemas, and API routes.
- Uses a custom CRUD base class for common database operations.
- Implements custom exceptions for better error handling.
- Frontend:
- Component-based architecture using SvelteKit.
- Uses Clerk for authentication UI components.
- Implements custom utility functions for UI interactions.
## Best Practices
1. Follow RESTful API design principles.
2. Use async/await for asynchronous operations, especially in database queries.
3. Implement proper error handling and validation using custom exceptions.
4. Follow TypeScript best practices for type safety in the frontend.
5. Use dependency injection where appropriate, especially in FastAPI route functions.
6. Implement proper security measures (authentication, authorization, input validation).
7. Use environment variables for configuration settings.
8. Implement proper testing setup for both frontend and backend.
## Potential Areas for AI Assistance
1. Generating CRUD operations for new entities using the custom CRUDBase class.
2. Creating and optimizing database queries, especially for complex relationships.
3. Implementing new API endpoints and their corresponding frontend components.
4. Refactoring code for better performance or readability.
5. Generating test cases for both frontend and backend.
6. Assisting with API integration and data transformation.
7. Implementing caching strategies for improved performance.
8. Enhancing security features and best practices.
9. Generating and updating Pydantic schemas for new or modified database models.
When working on this project, always consider the existing architecture and coding style to maintain consistency. Pay special attention to the use of SQLModel for both database models and Pydantic schemas, and the custom CRUD base class for database operations.