Noted Development Assistant
Expert assistant for working with the Noted project - a modern, simplistic anonymous note board application.
Project Context
Noted is a full-stack application allowing anonymous text note posting. The architecture consists of:
**Backend**: Go REST API with clean architecture (controller → service → repository → database)**Frontend**: Angular 17 client application**Database**: PostgreSQL with simple note storageKey Technical Details
**Backend Stack:**
Clean layered architecture patternPostgreSQL database (`noted_dev` database, `note` table with id/text columns)REST API on `localhost:8888` at `/api/note/*` endpointsCORS configured for `http://localhost:4200`Standard Go project structure with controller, service, repository, model, data, helper, and config packages**Frontend Stack:**
Angular 17 with TypeScript (strict mode)Services pattern for API communication (`api.service.ts`, `note.service.ts`)Standard Angular CLI structureDev server on `localhost:4200`**API Endpoints:**
`GET /api/note` - List all notes`GET /api/note/:noteId` - Get single note`POST /api/note` - Create note`PATCH /api/note/:noteId` - Update note`DELETE /api/note/:noteId` - Delete noteDevelopment Instructions
Setting Up the Development Environment
1. **Database Setup (PostgreSQL):**
- Create database: `noted_dev`
- Execute schema: `/server/sql/note_table.sql`
- Default connection string: `postgres:password@localhost:5432/noted_dev`
- Configure connection in `/server/config/database.go` if needed
2. **Backend Setup:**
- Navigate to `/server` directory
- Run `go mod tidy` to sync dependencies
- Start server with `go run main.go` (runs on port 8888)
3. **Frontend Setup:**
- Navigate to `/client` directory
- Install dependencies with `npm install`
- Start dev server with `npm run start` (runs on port 4200)
Common Development Tasks
**Frontend Commands (from `/client`):**
`npm run start` - Start development server`npm run build` - Production build`npm run test` - Run Karma unit tests`ng generate component <name>` - Generate new component**Backend Commands (from `/server`):**
`go run main.go` - Start development server`go mod tidy` - Clean up module dependenciesCode Organization
**Frontend (`/client/src/`):**
`app/` - Components, services, and application logic`types.ts` - TypeScript interfaces (Note, NotesResponse, Options)**Backend (`/server/`):**
`controller/` - HTTP request handlers (API layer)`service/` - Business logic layer`repository/` - Database access layer`model/` - Domain data structures`data/` - Request/response DTOs`helper/` - Utilities (JSON handling, error responses)`config/` - Application configuration (database setup)Request Flow Pattern
When implementing features, follow the established data flow:
1. Angular component/service makes HTTP request
2. Go controller receives request and validates
3. Controller delegates to service layer
4. Service applies business logic and calls repository
5. Repository executes database operations
6. Response flows back through layers to frontend
Working with the Codebase
**When adding new features:**
Backend: Create/modify files in controller → service → repository orderFrontend: Generate components with Angular CLI, add services as neededFollow the clean architecture pattern - keep layers separatedUse existing helper functions for JSON responses and error handling**When debugging:**
Check CORS configuration if frontend requests failVerify database connection in `/server/config/database.go`Ensure ports 4200 (frontend) and 8888 (backend) are availableCheck PostgreSQL is running and `noted_dev` database exists**When modifying the schema:**
Update SQL in `/server/sql/note_table.sql`Update Go models in `/server/model/`Update TypeScript interfaces in `/client/src/types.ts`Migrate database manually (no ORM migration system currently)Important Constraints
Maintain clean architecture separation (don't bypass layers)Keep CORS configuration secure (currently allows localhost:4200)Follow existing patterns for JSON responses and error handlingUse TypeScript strict mode compliance in frontendKeep note posting truly anonymous (no user authentication)Testing Approach
Frontend: Karma-based unit tests (run with `npm run test`)Backend: Manual testing recommended (no test framework configured)Integration testing: Start both services and test full request flow