A gRPC-based TODO application written in Go with SQLite database backend.
todoGRPC/
├── bin/ # Compiled binaries
├── internal/
│ ├── client/handles/ # Client-side handlers
│ ├── config/ # Configuration management
│ ├── database/ # Database layer (SQLite)
│ ├── models/ # Data models
│ ├── server/ # Server implementation
│ │ └── handles/ # Server-side gRPC handlers
│ ├── services/ # Business logic layer
│ └── tools/ # Development tools
├── todoproto/
│ ├── client/ # gRPC client
│ ├── proto/ # Protocol buffer definitions
│ └── server/ # gRPC server
├── pkg/datecalc/ # Date calculation utilities
├── googleapis/ # Google API proto files
└── Makefile # Build automation
- Go 1.22.1 or higher
- Protocol Buffers compiler (protoc)
- protoc-gen-go
- protoc-gen-go-grpc
Install protoc plugins:
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latestBuild the entire project:
make allBuild specific components:
make todoproto # Build todoproto server
make nextdate # Build nextdate serviceGenerate protobuf files:
protoc -Itodoproto/proto --go_opt=module=github.com/Vova4o/todogrpc --go_out=. --go-grpc_opt=module=github.com/Vova4o/todogrpc --go-grpc_out=. todoproto/proto/*.protoBuild server:
go build -o bin/todoproto/server ./todoproto/serverBuild client:
go build -o bin/todoproto/client ./todoproto/client./bin/todoproto/serverOptional flags:
-a, --ServerAddress- gRPC server address (default::50051)-d, --DBPath- Path to SQLite database (default:scheduler.db)-s, --Password- Application password
Example:
./bin/todoproto/server -a :50051 -d ./data/tasks.db./bin/todoproto/clientThe application provides the following gRPC services:
-
NextDate - Calculate the next date for recurring tasks
- Request:
NextDateRequest{now, date, repeat} - Response:
NextDateResponse{date}
- Request:
-
AddTask - Add a new task
- Request:
AddTaskRequest{title, comment, date, repeat} - Response:
AddTaskResponse{id}
- Request:
-
AllTasks - Stream all tasks (server streaming)
- Request:
TaskRequest{search} - Response: Stream of
AllTasksResponse
- Request:
SQLite table: scheduler
id- INTEGER PRIMARY KEY AUTOINCREMENTdate- TEXT NOT NULLtitle- TEXT NOT NULLcomment- TEXTrepeat- TEXT(128)
Index on date field for optimized queries.
Configuration is managed via:
- Command-line flags
- Environment variables
- Config files (via Viper)
Priority: Flags > Environment Variables > Config File
go test ./...- internal/database: Database operations and storage layer
- internal/services: Business logic (AddTask, AllTasks, etc.)
- internal/server/handles: gRPC service implementations
- internal/models: Data structures and DTOs
- Define service in
.protofile - Run
make todoprototo generate Go code - Implement service handler in
internal/server/handles/ - Add business logic in
internal/services/ - Add database methods in
internal/database/if needed
[Add your license here]
[Add contribution guidelines here]