How grishj/expense_tracker works
Project type and purpose
• This is a full-stack mobile expense-tracking application:
• Frontend: React Native (Expo) mobile app for iOS/Android
• Backend: Node.js/Express REST API with Prisma ORM
• Purpose: Allow users to authenticate (email/password or social), record expenses by category, view interactive charts, and manage profiles.
File structure
• Top-level
• .expo/ → Expo configuration & settings
• README.md → Project overview, features, setup
• backend/ → REST API project
• frontend/ → React Native mobile app
• backend/
• src/index.js → Express app entry point
• src/routes/ → Route definitions (auth, categories, expenses, profile)
• src/middleware/authMiddleware.js → JWT validation
• src/utils/ → Token generation, Prisma client wrapper
• prisma/ → Database schema and migrations (init, schema with category, expense, user, profile fields)
• frontend/
• App.js, index.js → App launcher and navigation setup
• src/navigation/AppNavigator.js → Screen routing
• src/screens/ → UI screens: Login, Signup, Home, AddExpense, AllExpenses, Chart, Profile
• src/utils/ → api.js (Axios instance), auth.js (AsyncStorage token helpers)
• assets/ → images for UI
README for additional insights
• Lists features: authentication (JWT + social), expense CRUD, charts (react-native-chart-kit), pull-to-refresh, floating button
• Specifies backend endpoints and expected payloads
• Mentions technologies: React Native, React Navigation, Axios, AsyncStorage, Express, Prisma
a. Main components
1. Mobile Client (Expo/React Native App)
2. API Gateway / Express Server
3. Authentication Layer (JWT + social OAuth)
4. Business Logic Layer (routes/controllers for categories, expenses, profile)
5. Data Layer (Prisma ORM + relational database)
6. External OAuth Providers (Facebook, Google)
b. Relationships & interactions
• Mobile Client ⇄ Express API (HTTPS/JSON)
• Express API uses authMiddleware to verify JWT on protected routes
• For social login: Express API exchanges OAuth tokens with Facebook/Google, issues JWT
• Express API ⇄ Database via Prisma Client
c. Architectural patterns & principles
• Layered architecture: Presentation (mobile), API/Controller, Service/ORM, Database
• RESTful design: Separate endpoints for resource operations (GET, POST)
• Token-based stateless authentication
• MVC-lite: Routes as controllers, Prisma models as data layer
d. Key technologies & libraries
• React Native (Expo) + React Navigation + react-native-chart-kit
• Axios for HTTP client, AsyncStorage for token storage
• Node.js, Express.js, JWT for auth, Prisma ORM, PostgreSQL (or compatible)