aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
blob: b390b630eeb6d7714dc151148f03a660085facd9 (plain) (blame)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Enhanced Personal Finance Management

## Description

An application designed to help manage personal finances, including income (like salary) and loans. It provides daily notifications, tracks progress towards financial goals, and offers insights into spending habits. The goal is to provide an enhanced, goal-oriented financial management experience.

## Core Features

*   **Income & Expense Tracking:** Log salary, loan payments, and other transactions.
*   **Loan Management:** Keep track of loan balances, due dates, and payment history.
*   **Goal Setting:** Define financial goals (e.g., saving for a down payment, paying off debt) and track progress.
*   **Daily Notifications:** Receive daily summaries or reminders (configurable).
*   **Reporting & Insights:** Visualize financial data (future goal).
*   **User Authentication:** Secure login for personal data.

## Tech Stack

*   **Backend:** Go (Golang)
    *   API Framework: Gin Gonic (`github.com/gin-gonic/gin`)
    *   Database ORM: GORM (`gorm.io/gorm`) with PostgreSQL Driver (`gorm.io/driver/postgres`)
    *   Notifications: Go routine scheduler + Email/Push Notification service
*   **Frontend:** React / Next.js with TypeScript
    *   UI Components: shadcn/ui (using Tailwind CSS)
    *   State Management: Zustand / Redux Toolkit (to be decided)
    *   Data Fetching: React Query / SWR
*   **Database:** PostgreSQL
*   **Deployment:** Self-hosted (OpenBSD using native tools/rc.d scripts)

## High-Level Architecture

1.  **Frontend (React/Next.js + shadcn/ui):** Interacts with the user, displays financial information and goals, and communicates with the backend API.
2.  **Backend API (Go):** Handles business logic, data persistence, user authentication, and communication with the database and notification services.
3.  **Database (PostgreSQL):** Stores user data, transactions, loans, goals, etc.
4.  **Notification Service (Go Routine/External):** Periodically checks for required notifications (daily summaries, goal updates) and sends them out.

## Project Structure

```
.
├── backend/              # Go Backend Code
│   ├── cmd/              # Main application(s) entrypoint
│   │   └── api/          # Entrypoint for the main API server
│   │       └── main.go
│   ├── internal/         # Private application and library code
│   │   ├── api/          # API handlers, routes, middleware
│   │   ├── config/       # Configuration loading
│   │   ├── core/         # Core business logic (services, domain models)
│   │   ├── database/     # Database interaction (models, migrations, queries)
│   │   ├── models/       # Data structures/entities
│   │   └── notification/ # Notification logic
│   ├── pkg/              # Public library code (if any, shareable)
│   ├── go.mod
│   └── go.sum
├── frontend/             # React/Next.js Frontend Code
│   ├── app/              # Next.js App Router structure
│   │   ├── (auth)/       # Routes for authentication (layout)
│   │   │   └── login/
│   │   │   └── signup/
│   │   ├── (main)/       # Main application routes (layout)
│   │   │   └── dashboard/
│   │   │   └── loans/
│   │   │   └── goals/
│   │   │   └── settings/
│   │   └── layout.tsx
│   │   └── page.tsx      # Landing/main page
│   ├── components/       # Shared React components (UI, shadcn)
│   │   ├── ui/           # shadcn/ui generated components
│   │   └── shared/       # Custom shared components
│   ├── hooks/            # Custom React hooks
│   ├── lib/              # Utility functions, helpers, API client
│   ├── styles/           # Global styles, tailwind config
│   ├── public/           # Static assets
│   ├── package.json
│   └── tsconfig.json
├── .gitignore
└── README.md
```

## Project Plan / To-Do List

**Phase 1: Backend Core Setup (Go)**

*   [x] Initialize Go project (`go mod init finance/backend`)
*   [x] Set up API framework (Gin Gonic)
*   [x] Set up ORM/DB library (GORM)
*   [x] Design database schema (Users, Accounts, Transactions, Loans, Goals)
*   [x] Set up database connection and migrations
*   [x] Add CORS middleware for cross-origin requests
*   [x] Implement User Authentication (Signup, Login, JWT/Session Management)
*   [x] Create basic CRUD APIs for Accounts (e.g., Salary Source, Bank Account)
*   [x] Create basic CRUD APIs for Transactions (Income, Expense)
*   [x] Create basic CRUD APIs for Loans
*   [x] Create basic CRUD APIs for Goals
*   [x] Set up initial logging and error handling
*   [x] Write unit/integration tests for core API endpoints

**Phase 2: Frontend Foundation (React/Next.js + shadcn/ui)**

*   [x] Initialize React/Next.js project (`create-next-app`) with TypeScript
*   [x] Set up Tailwind CSS
*   [x] Integrate shadcn/ui and set up base theme/components
*   [x] Set up routing
*   [x] Implement basic layout (Navigation, Sidebar, Main Content Area)
*   [x] Set up state management solution
*   [x] Implement Login/Signup pages and connect to backend auth APIs
*   [x] Create components for displaying account balances
*   [x] Create forms for adding/editing transactions using shadcn components
*   [x] Create components for listing transactions

**Phase 3: Feature Implementation - Loans & Goals**

*   **Backend:**
    *   [x] Implement logic for loan calculations (remaining balance, interest if applicable)
    *   [ ] Implement logic for goal progress tracking based on transactions/savings
    *   [ ] Refine APIs for Loans and Goals based on frontend needs
    *   [ ] Add validation logic for all inputs
    *   [ ] Enhance tests for loan and goal logic
*   **Frontend:**
    *   [x] Create components for displaying loan details and history
    *   [x] Create forms for adding/editing loans
    *   [ ] Create components for displaying financial goals and progress
    *   [ ] Create forms for adding/editing goals
    *   [x] Connect loan and goal components to backend APIs

**Phase 4: Notifications**

*   **Backend:**
    *   [ ] Design notification content (daily summary, goal reminders)
    *   [ ] Implement a scheduler (e.g., using `time.Ticker` or a library like `cron`) to trigger daily tasks
    *   [ ] Implement logic to gather data for notifications
    *   [ ] Integrate with an email service (e.g., SendGrid) or push notification service
    *   [ ] Add user preferences for notifications (enable/disable, time)
*   **Frontend:**
    *   [ ] Create UI for managing notification preferences

**Phase 5: Enhancements & Refinements**

*   [ ] Implement reporting/visualization features (e.g., charts for spending categories)
*   [ ] Refine UI/UX based on usability testing
*   [ ] Improve error handling and user feedback
*   [ ] Add more comprehensive tests (end-to-end)
*   [ ] Security hardening (review dependencies, potential vulnerabilities)
*   [ ] Optimize database queries and API performance

**Phase 6: Deployment**

*   [ ] Build Go binary for OpenBSD
*   [ ] Build frontend static assets
*   [ ] Set up PostgreSQL on OpenBSD server
*   [ ] Create OpenBSD `rc.d` script for the Go backend service
*   [ ] Configure web server (e.g., OpenBSD's `httpd`) to serve frontend and proxy backend
*   [ ] Set up CI/CD pipeline (e.g., GitHub Actions, or manual process)
*   [ ] Configure domain, SSL certificates (e.g., using `acme-client`)
*   [ ] Monitor application performance and logs (e.g., using system logs)

## Setup & Installation

```bash
# Clone the repository
git clone <repository-url>
cd <project-directory>

# Backend Setup (Placeholder)
cd backend
# ... add Go setup instructions ...
go run main.go

# Frontend Setup (Placeholder)
cd ../frontend
# ... add Node/npm/yarn setup instructions ...
npm run dev
```

## Usage

(Instructions on how to use the application once running)

## Contribution Guidelines

(How others can contribute to the project - PR process, coding standards etc. - Placeholder)

## License

(Specify the project license, e.g., MIT - Placeholder)