How insideup/contest-7-be works
InsideUp is a FastAPI backend for user accounts, diaries, community posts and reactions, and emotion-based character responses. Requests enter through the registered v1 routers; account and community actions delegate to CRUD operations backed by SQLAlchemy, while authenticated routes use JWT-based user lookup. Emotion routes retrieve a user’s latest emotion from a separate chatbot service and map it to a character asset path. The README provides only a directory listing, so coverage of major product areas follows the source index; unsampled details and relationships are omitted.
Main entry points: database.py SQLAlchemy session · community_crud.py Community operations · main.py FastAPI app · character_emotion.py Emotion routes
Components 24
API routes
- FastAPI app
main.py - User routes
app/api/v1/user.py - Diary routes
app/api/v1/diary.py - Community routes
app/api/v1/community.py - Emotion routes
app/api/v1/character_emotion.py
Product workflows
- Account operations
app/crud/user_crud.py - Diary operations
app/crud/diary_crud.py - Community operations
app/crud/community_crud.py - Character mapping
app/services/character_services.py - User schemas
app/schemas/user_schema.py - Diary schemas
app/schemas/diary_schema.py - Post schemas
app/schemas/post_schema.py - Emotion response schema
app/schemas/character_emotion_schema.py
Persistence
- SQLAlchemy session
app/core/database.py - User records
app/models/user_model.py - Diary records
app/models/diary_model.py - Post records
app/models/post_model.py - Comment records
app/models/comment_model.py - Reaction and emotion models
app/models
Identity and configuration
- Database configuration
app/core/config.py - JWT user service
app/services/user.py
Other components
- API client
- Chatbot emotion API
- SQL database
Connections 33
- API client → FastAPI app: sends requests
- FastAPI app → User routes: registers routes
main.py - FastAPI app → Diary routes: registers routes
main.py - FastAPI app → Community routes: registers routes
main.py - FastAPI app → Emotion routes: registers routes
main.py - User routes → Account operations: calls
app/api/v1/user.py - Diary routes → Diary operations: calls
app/api/v1/diary.py - Community routes → Community operations: calls
app/api/v1/community.py - User routes → User schemas: validates with
app/api/v1/user.py - Diary routes → Diary schemas: uses
app/api/v1/diary.py - Community routes → Post schemas: uses
app/api/v1/community.py - Emotion routes → Emotion response schema: returns
app/api/v1/character_emotion.py - Emotion routes → JWT user service: authenticates via
app/api/v1/character_emotion.py - Emotion routes → Chatbot emotion API: fetches latest emotion
app/api/v1/character_emotion.py - Emotion routes → Character mapping: maps emotion
app/api/v1/character_emotion.py - User routes → JWT user service: uses token service
app/api/v1/user.py - Account operations → User records: creates and updates
app/crud/user_crud.py - Diary operations → Diary records: queries and writes
app/crud/diary_crud.py - Community operations → Post records: queries and writes
app/crud/community_crud.py - Community operations → Comment records: queries and writes
app/crud/community_crud.py - Community operations → Reaction and emotion models: counts reactions
app/crud/community_crud.py - Community operations → User records: ensures guest user
app/crud/community_crud.py - JWT user service → User records: loads user
app/services/user.py - Account operations → User schemas: accepts payload
app/crud/user_crud.py - Diary operations → Diary schemas: uses payload
app/crud/diary_crud.py - Community operations → Post schemas: accepts payload
app/crud/community_crud.py - SQLAlchemy session → Database configuration: reads connection settings
app/core/database.py - SQLAlchemy session → SQL database: connects to
app/core/database.py - User records → SQLAlchemy session: declares table on
app/models/user_model.py - Diary records → SQLAlchemy session: declares table on
app/models/diary_model.py - Post records → SQLAlchemy session: declares table on
app/models/post_model.py - Comment records → SQLAlchemy session: declares table on
app/models/comment_model.py - Reaction and emotion models → SQLAlchemy session: declares tables on
app/models/diary_model.py