98 lines
3.5 KiB
Markdown
98 lines
3.5 KiB
Markdown
# Carry Your Live - Project Summary
|
|
|
|
## Overview
|
|
A minimalist, offline-first task management app built with Expo, React Native, and WatermelonDB. Features three primary screens: To-Do List, Add New Task, and Calendar with bottom navigation.
|
|
|
|
## Core Features
|
|
- **Offline-First Architecture**: Full CRUD operations work offline with WatermelonDB + SQLite
|
|
- **Auto-Sync**: Background synchronization with custom Postgres API when online
|
|
- **Cross-Platform**: iOS, Android, and Web from single codebase
|
|
|
|
## Tech Stack
|
|
| Layer | Technology |
|
|
|-------|------------|
|
|
| Framework | Expo (React Native) |
|
|
| Language | TypeScript |
|
|
| Navigation | Expo Router (file-based) |
|
|
| Database | WatermelonDB + SQLite |
|
|
| State | WatermelonDB (reactive queries, no Redux needed) |
|
|
| Forms | React Hook Form + Zod validation |
|
|
| UI Components | React Native Paper + Custom SVG icons |
|
|
| Animations | React Native Reanimated |
|
|
| Date/Time | @react-native-community/datetimepicker + date-fns |
|
|
| Build | Gradle (local APK) |
|
|
| CI/CD | Gitea Actions |
|
|
|
|
## Project Structure
|
|
```
|
|
carry-your-live/
|
|
├ app/
|
|
│ ├── _layout.tsx # Root layout + DatabaseProvider
|
|
│ ├── (tabs)/
|
|
│ │ ├── _layout.tsx # Bottom tab navigator
|
|
│ │ ├── index.tsx # Tasks screen
|
|
│ │ ├── calendar.tsx # Calendar screen
|
|
│ │ └── settings.tsx # Settings screen
|
|
│ └── add-task.tsx # Add Task screen
|
|
├ src/
|
|
│ ├── components/ # Reusable UI components
|
|
│ ├── database/
|
|
│ │ ├── schema.ts # WatermelonDB schema
|
|
│ │ ├── index.ts # Database instance + collections
|
|
│ │ └── sync.ts # Custom API sync adapter
|
|
│ ├── models/
|
|
│ │ ├── Task.ts
|
|
│ │ ├── Category.ts
|
|
│ │ └── Subtask.ts
|
|
│ ├── hooks/
|
|
│ │ ├── useDatabase.tsx # Database context & providers
|
|
│ │ └── useTasks.tsx # Task queries with reactive state
|
|
│ ├── constants/
|
|
│ │ └── index.ts # Categories, priorities, colors
|
|
│ └── types/
|
|
│ └── index.ts # TypeScript interfaces
|
|
```
|
|
|
|
## Data Models
|
|
- **Task**: id, title, description, categoryId, priority, completed, dueDate, dueTime, createdAt, updatedAt, subtasks
|
|
- **Category**: id, name, color, order
|
|
- **Subtask**: id, taskId, title, completed, order, createdAt, updatedAt
|
|
|
|
## Default Categories
|
|
| Name | Color | Order |
|
|
|------|-------|-------|
|
|
| Work | #E53935 (Red) | 0 |
|
|
| Personal | #43A047 (Green) | 1 |
|
|
| School | #1E88E5 (Blue) | 2 |
|
|
| Shopping | #FB8C00 (Orange) | 3 |
|
|
| Health | #8E24AA (Purple) | 4 |
|
|
| Finance | #FDD835 (Yellow) | 5 |
|
|
|
|
## Priority Colors
|
|
| Priority | Color |
|
|
|----------|-------|
|
|
| None | #9E9E9E |
|
|
| Low | #43A047 |
|
|
| Medium | #FB8C00 |
|
|
| High | #E53935 |
|
|
| Critical | #B71C1C |
|
|
|
|
## Sync API
|
|
Custom API at `http://localhost:3000/api` (configurable in `src/database/sync.ts`):
|
|
- **Pull**: GET /sync?since={timestamp} - returns categories, tasks, subtasks, timestamp
|
|
- **Push**: POST /sync/push - body with changes { categories, tasks, subtasks } + lastPulledAt
|
|
|
|
## Getting Started
|
|
```bash
|
|
npm install
|
|
npx expo start
|
|
# Platform-specific:
|
|
npx expo start --ios
|
|
npx expo start --android
|
|
npx expo start --web
|
|
```
|
|
|
|
## Build Commands
|
|
- `cd android && ./gradlew assembleDebug` - Debug APK
|
|
- `cd android && ./gradlew assembleRelease` - Release APK
|
|
- `npm run desktop` - Electron desktop app |