Skip to content

ISDC-Helsinki/splitbit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codename SplitBit

Cost-keeping app for friends and households built using latest and greatest software stack featuring native clients.

Development setup

The development is openapi schema-driven making the openapi.yml specification file the single source of truth for the api. This allows us to make heavy use of code generation, yielding us effortless, type-safe client-server communication. This pregenerated code shall not be commited to the actual repository (and is therefore .gitignored). Each subproject includes the prerequisite step related to code generationand assumes that one is already in its subdirectory.

Server (/server)

The server handles the requests and communication with the database. SplitBit uses ogen to bootstrap all the request, response models, validation and routing based on the openapi.yml spec file. The only thing that needs to be done then is implementing the handler functions that mostly carry out the communication with the database. That communication is facilitated with sqlc which is a thin utility generating type safe code from SQL quries and the db schema. The underlying dbms is sqlite3. Code generation commands are defined within the main.go file. Run go generate to do the necessary generation. After that in order to build the app you run go build and ./server runs the server. Now you clients are ready to interact with it. The server uses data.db file to store the user data. If no file is present, the server will create it on the first run and initialize it with schema.sql. The database will be empty initially so you can run ./insertSampleData.sh script to fill it with random but plausible looking data. It will also attempt to install the sqlbs tool (if that fails please install it manually and have it present in the path).

Web Client (/web)

Copy file .env.example to .env and adjust the url your client is running at (if you have changed it). Next, run npx openapi-typescript ../openapi.yml -o src/lib/api/schema.ts to generate api client files for the communication with the server. Finally, run npm install to get all the dependencies and npm run dev -- --open to get the client working.

Android Client (/android)

First, create the api client code by running gradle openApiGenerate to create the api client and the necessary models. Next, open the project in Android Studio and click the run symbol in the top bar or first change the target device to a physical phone if you've connected one. By default it uses a public instance hosted on isdc's servers. If you are developing server features at the same time, you might want to change that to make your phone/emulator do its requests to your computer. To do so, modify baseUrl inside src/main/java/fi/isdc_helsinki/splitbit/repositories/ApiClient.kt with the local ip address you get from running commands such as ip address or ifconfig AND the port number the server is running on. Then modify the ip address inside app/src/main/res/xml/network_security_config.xml to allow android to make these calls.

About

Cost-keeping app for friends and households

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 8