People can find house/building to buy/sell
nothing fancy, just normal monolith but with multiple database connection
browser --> svelte+monolith --> tarantool/clickhouse
mobile --> monolith --> tarantool/clickhouse
conf: shared configurationmain: inject all dependenciessvelte: web frontenddeploy: scripts for deploying to productionMVC-like structure
presentation -> serialization and transportdomain -> business logic, DTOmodel -> persistence/3rd party endpoints, DAOseparates read/query and write/command into different database/connection.
rq = read/query (OLTP) -> to tarantool replicawc = write/command (OLTP) -> to tarantool mastersa = statistics/analytics (OLAP) -> to clickhouse# first time for development
make setup
# start docker
docker compose up # or docker-compose up
# start frontend auto build
cd svelte
pnpm i
bun watch
# do migration (first time, or everytime tarantool/clickhouse docker deleted,
# or when there's new migration)
go run main.go migrate
go run main.go import
# start golang backend server, also serving static html
air web
# manually
go run main.go web
# start reverse proxy, if you need test oauth
caddy run # foreground
caddy start # background
docker exec -it street-tarantool1-1 tarantoolctl connect userT:[email protected]:3301
# box.execute [[ SELECT * FROM "users" LIMIT 10 ]]
docker exec -it street-clickhouse1-1 clickhouse-client -u userC
# SELECT * FROM actionLogs ORDER BY createdAt DESC LIMIT 10;
# input:
# - model/m*.go
./gen-orm.sh
# or
cd model
go test -bench=BenchmarkGenerateOrm
# then go generate each file
# output:
# - model/m*/rq*/*.go # -- read/query models
# - model/m*/wc*/*.go # -- write/command mutation models
# - model/m*/sa*/*.go # -- statistic/analytics models
# input:
# - domain/*.go
# - model/m*/*/*.go
# - svelte/*.svelte
./gen-views.sh
# or
cd presentation
go test -bench=BenchmarkGenerateViews
# output:
# - presentation/actions.GEN.go # -- all possible commands
# - presentation/api_routes.GEN.go # -- automatic API routes
# - presentation/web_view.GEN.go # -- all template that can be used in web_static.go
# - presentation/cmd_run.GEN.go # -- all CLI commands
# - svelte/jsApi.GEN.js # -- all API client SDK
go run main.go migrate
go run main.go import
go run main.go import_location # require google API key
# using command line
go run main.go cli guest/register '{"email":"[email protected]"}'
# using curl
go run main.go web
curl -X POST -d '{"email":"[email protected]"}' localhost:1234/guest/register
cd deploy
./deploy.sh
# docker spawning failed (because test terminated improperly), run this:
alias dockill='docker kill $(docker ps -q); docker container prune -f; docker network prune -f'
presentation/web_static.gothere is no space with name [tableName], table default. [tableName] does not existsgo run main.go migrate to do migrationCommand 'caddy' not foundCommand 'air' not foundmake setupCommand 'replacer' not foundmake setupCommand 'gomodifytags' not foundmake setupCommand 'farify' not foundmake setupCommand 'goimports' not foundmake setup.env.override file.env.override no such file or directory.env.override filefailed to stat the template: index.htmlcd svelte; npm run watch at least onceTarantoolConf) Connect: dial tcp 127.0.0.1:3301: connect: connection refused"docker-compose upClickhouseConf) Connect: dial tcp 127.0.0.1:9000: connect: connection refuseddocker-compose updocker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))model/m[schema]/[schema]_tables.go folder, create benchmark function to generate and migrate the tables in RunMigration function../gen-orm.sh, create helper function on model/w[schema]/[rq|wc|sa][schema]/[schema]_helper.go or 3rd party wrapper in model/x[repo]/x[provider].godomain/[role].go containing all business logic for that roledomain/[role]_test.go to make sure all business requirement are metcd presentation; go get -bench=BenchmarkGenerateViews, start web service air websvelte/, start frontend service cd svelte; npm run watchcd presentation; go get -bench=BenchmarkGenerateViewspresentation/web_static.godocker-compose.yml and add to domain/0_main_test.go so it would run on integration test. Create the conf/[provider].go and model/x[repo]/x[provider].go to wrap the 3rd party connector.presentation/1_codegen_test.gocd presentation; go get -bench=BenchmarkGenerateViewsdocker compose instead of dockertest?USE_COMPOSE=x before running testnpm run watch will convert .svelte files into .html, . /gen-views.sh will generate vew_view.GEN.go that can be called by web_static.go to render the .html filestype XXIn, type XXOut, const XXAction,
and func (d Domain) XX(in XXIn) XXOut inside domain/ it will be
automatically
added
to api_routes.GEN.gomodel/m[schema]/[schema]_tables.go and model/m[schema]/ [schema]_tables_test.go then run ./gen-orm.sh, it would generate
model/[rq|wc|sa][schema].go, you can extend the method of generated
structs ([rq|wc|sa][schema]) on another file inside the same package.[schema]Meta on domain/, then just call your query
method based on zCrud.Pager (it would generate the proper SQL query),
then use svelte component that can render the form and table/list for you.memtx used for kv query pattern, anything that often being read
and updated (eg. transactions), vinyl used for range queries, anything
that rarely being updated (eg. mutation log, history), clickhouse used
for analytics queries pattern, anything that will never being updated
ever (eg. action logs, events)street/_tmpdb/*: open /*/street/*: permission denied on go mod tidysudo chmod a+rwx -R _tmpdb or make modtidy