The following tools are prerequisites for development work:
- go 1.21
- docker && docker-compose
- wire for dependency management
- make for task running
- sqlc for generating database code
- gci for sorting imports
- tagalign for aligning struct tags
- terraform for deploying/formatting
- cloud_sql_proxy for production database access
- fieldalignment (
go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest
)
It's a good idea to run make test lint integration_tests
before commits.
- clone this repository
- run
make dev
- http://localhost:8000/
This service, out of the box, supports:
- self-service user signup
- users can be associated with a group of users (called an account)
- users can define a default account
- users can sign up with an invitation token that will immediately associate them with a given account
- users have RBAC permissions associated with their accounts and the base service
- users can enable two factor verification
- users can rotate their two factor secret
- users can change their password, avatar, and details
- users can reset passwords if they forget them
- users can verify their email address
- account admins can change details about their account
- account admins can invite users to their accounts
- service admins can create settings
- users can create configurations for these settings
- users can create webhooks for events related to their accounts
- webhooks are executed asynchronously
- all data changes are published to an event queue
- this can be hooked into to do things like send confirmation emails
- user notifications support
- notifications can be arbitrarily created by admins, or created in the aforementioned async flow
- oauth2 client support
- service admins can create oauth2 clients for users to authenticate with
- Terraform code for deploying service to GCP
- Stripe support
- abstracted such that you could support an alternative payment provider (I just haven't found a better one than Stripe)
- analytics support
- support for Segment, Rudderstack, and Posthog
- search support
- support for Algolia and Elasticsearch
- users are automatically indexed into a search engine provider of your choosing
- trivial to add other data types to other indices
- managed email service support
- feature flag support
- support for LaunchDarkly and Posthog
- message queue support
- object storage support
- cache support
- support for in-memory and Redis
- full unit tests for every package
- full service API client
- integration tests that spin up the full service against a proper database using the aforementioned API client
- generated sqlc queries
- generated configuration files
- CI steps that validate generated files
- CI steps that test on every push to a PR
flowchart LR
APIServer("API Server")
PublicInternet("Public Internet")
Sendgrid("Sendgrid")
Segment("Segment")
Algolia("Algolia")
Cron("GCP Cloud Scheduler")
DataChangesWorker("Data Changes Worker")
OutboundEmailerWorker("Outbound Emailer")
SearchDataIndexSchedulerWorker("Data Index Scheduler")
SearchDataIndexerWorker("Search Data Indexer")
PublicInternet-->APIServer
Cron-->SearchDataIndexSchedulerWorker
DataChangesWorker-->OutboundEmailerWorker
DataChangesWorker-->SearchDataIndexerWorker
SearchDataIndexSchedulerWorker-->SearchDataIndexerWorker
SearchDataIndexerWorker-->Algolia
APIServer-->DataChangesWorker
DataChangesWorker-->Segment
OutboundEmailerWorker-->Segment
OutboundEmailerWorker-->Sendgrid
Algolia-->APIServer