53 lines
3.7 KiB
Markdown
53 lines
3.7 KiB
Markdown
Lets create a new project. I've already created the go.mod file.
|
|
Be pricise and summaritive.
|
|
The project is written in modern go.mod
|
|
|
|
The project must do the following:
|
|
A service that connects to whatsapp via the whatsmeow api. When new message are received, it will send the message to all registered hooks.
|
|
The service must have a list of registered web hooks.
|
|
Whet a hook is called, it must send a message to whatsapp.
|
|
Name the hooks and enpoints correctly.
|
|
Two way communication is needed.
|
|
|
|
First Phase: COMPLETED
|
|
Instance / Config level hooks and whatsapp accounts.
|
|
|
|
- config package: Configuration via viper, loaded from config.json. Covers server host/port, whatsapp accounts, hooks, MQTT, and WhatsApp Business API credentials.
|
|
- logging package: Structured logging with severity levels using zerolog.
|
|
- whatsapp package (whatsmeow): Connects to personal WhatsApp accounts via tulir/whatsmeow. Handles QR code auth flow, session persistence, and message send/receive.
|
|
- whatsapp package (businessapi): WhatsApp Business API integration. Supports sending messages, templates, extended sending, business profile and catalog management.
|
|
- server command: HTTP server exposing hook endpoints, health check (/health), and QR code streaming for account pairing. Runs on configurable port (default 8825).
|
|
- cli command: Cobra-based CLI for server interaction — health checks, account management, hook management, and pushing messages via the server.
|
|
- events system: Pub/sub event bus for whatsapp lifecycle events (connect, disconnect, message received, send success/failure). Events flow between whatsmeow, business API, hooks, and MQTT.
|
|
- hooks package: Webhook registration and HTTP dispatch. Incoming whatsapp messages are forwarded to all registered hook URLs.
|
|
- cache package: In-memory message caching layer.
|
|
- event logger: Persistent event logging to disk for debugging and audit.
|
|
- MQTT support: Optional MQTT broker integration for event routing and message delivery.
|
|
- Docker: Dockerfile and docker-compose with health checks, session/config volume mounts, and resource limits.
|
|
- CI/CD: GitHub Actions workflows with lint and test steps.
|
|
- Static pages: Privacy policy and terms of service served via the server.
|
|
|
|
Second Phase:
|
|
|
|
- Setup a tooldoc folder for you if not exists to save summaries of the tools you must use. Reference what is there as well. Update it if you found new tools or more information on tools.
|
|
- Save library and tools usage instructions for you.
|
|
- Make a code guideline for you
|
|
- Use makefile to build, test and migrate. For backend and frontend. e.g. build build-ui build-server etc.
|
|
- Storage in postgresql and sqlite based on user selection.
|
|
- Use relspecgo to convert dbml database models to BUN models. https://git.warky.dev/wdevs/relspecgo
|
|
- Place sql in sql/ folder, dbml models in sql/schema.dbml file
|
|
- Scripts in sql/postgres and sql/sqlite folders
|
|
- Place models in models package
|
|
- webserver package: Use https://github.com/bitechdev/ResolveSpec It has a server package. Its has security and authentication as well. Use as much as you can from ResolveSpec for the project.
|
|
- Link: https://github.com/bitechdev/ResolveSpec
|
|
- Use BUN ORM
|
|
- Use React with Mantine and Tanstack Start for the admin site.
|
|
- api subpackage: Must contain all API endpoints and implement https://github.com/bitechdev/ResolveSpec
|
|
- Use oranguru for grids and forms. -> https://git.warky.dev/wdevs/oranguru
|
|
|
|
- Interface:
|
|
- auth package: This package should handle authentication in a secure way. It should be able to authenticate users, generate tokens, and verify user credentials. Use Resolvespec for API Auth.
|
|
- User login
|
|
- API Keys per user.
|
|
- User interace to setup user level hooks and whatsapp accounts.
|