-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added new target - backed (optional as everything) - Added new feature SQLDelight (preconfigured for all client platforms with showcases) - Renamed composeApp to app (the template itself is based on compose, so no need to write this prefix in client app) - Refactored some core components to be more simple to use - Updated documentation, showcases and diagrams
- Loading branch information
1 parent
b692cfd
commit 65824f5
Showing
248 changed files
with
1,743 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ captures | |
**/xcshareddata/WorkspaceSettings.xcsettings | ||
*.lock | ||
.kotlin | ||
*-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# About | ||
|
||
Simple facade API to start working with analytics events without the actual implementation. The implementation can be provided later during the development phase without changing the facade logic. | ||
Sooner or later, the app may need to log events into an analytics system (Google Analytics, Amplitude, AppsFlyer, etc.). | ||
The Facade Analytics API provides a general functionality to start logging events from the beginning, even without an actual implementation. Later, you can add the required implementation without impacting the entire codebase. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# About | ||
|
||
Basic facade API to begin configuring the layer without depending on any external implementation. | ||
The implementation can be provided later during the development phase, if necessary, without altering the facade logic. | ||
All applications operate with some read-only configurations (feature flags, URLs, etc.) required for the app to function properly in different environments. | ||
The Config API provides an intuitive facade for managing such configurations easily. This allows you to change the underlying implementation later (e.g., integrating Firebase Remote Config) without impacting the entire codebase. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# About | ||
|
||
SQLDelight generates typesafe Kotlin APIs from your SQL statements. It verifies your schema, statements, and migrations at compile-time and provides IDE features like autocomplete and refactoring which make writing and maintaining SQL simple. | ||
|
||
# Links | ||
|
||
- [Official Site](https://cashapp.github.io/sqldelight/) | ||
- [Integration Guide](https://cashapp.github.io/sqldelight/2.0.2/multiplatform_sqlite/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Usage | ||
|
||
## Overview | ||
|
||
- Component package: `app.datasource.database.sqldelight` | ||
- DI integration: `app.di.datasource.ProvidesSqlDelightSource` | ||
|
||
The integration includes the following components: | ||
|
||
- **AppDatabase**: An SQLite database object generated based on the SQLDelight scripts included in the project. | ||
- **AppSqlDelightSource**: Serves as a holder of the `AppDatabase` instance and acts as a service locator for all DAO objects. | ||
- **User.sq**: An example script that generates the `User` entity and the DAO layer to work with it. All **SQLDelight scripts** are located in the `app/src/commonMain/sqldelight` directory. | ||
|
||
## Create new Entity and DAO | ||
|
||
SQLDelight generates all entities and DAO objects based on the SQL scripts. | ||
|
||
The official guide can be found here: [https://cashapp.github.io/sqldelight/2.0.2/multiplatform_sqlite/#defining-the-schema](https://cashapp.github.io/sqldelight/2.0.2/multiplatform_sqlite/#defining-the-schema). | ||
|
||
Imagine you need to add a new entity called **Address** and a **DAO** layer to work with it. Here are the steps to follow: | ||
|
||
### 1. Create the `Address.sq` script in the `app/src/commonMain/sqldelight` directory | ||
|
||
``` | ||
You can use the `User.sq` script as a template. | ||
``` | ||
|
||
```sqldelight | ||
CREATE TABLE IF NOT EXISTS address ( | ||
id INTEGER PRIMARY KEY NOT NULL, | ||
country TEXT, | ||
city TEXT, | ||
street TEXT | ||
); | ||
count: | ||
SELECT count(*) FROM address; | ||
getAll: | ||
SELECT * FROM address | ||
ORDER BY id DESC; | ||
getAllPaginated: | ||
SELECT * | ||
FROM address | ||
ORDER BY id DESC | ||
LIMIT :limit OFFSET :offset; | ||
insert: | ||
INSERT INTO address(country, city, street) | ||
VALUES (?, ?, ?); | ||
insertAddress: | ||
INSERT INTO address | ||
VALUES ?; | ||
update: | ||
UPDATE address | ||
SET country = ?, city = ?, street = ? | ||
WHERE id = ?; | ||
delete: | ||
DELETE FROM address WHERE id = ?; | ||
``` | ||
|
||
### 2. Start using it from your code :) | ||
|
||
Once the project is recompiled, you can access the generated entity and DAO layer from your code. | ||
|
||
```kotlin | ||
class EditAddressViewModel( | ||
private val databaseSource: AppSqlDelightSource | ||
) : BaseViewModel() { | ||
|
||
fun onAdd() = launchAsync { | ||
val database = databaseSource.getDatabase() | ||
database.addressQueries.insert("Country", "City", "Street") | ||
} | ||
|
||
fun onDelete(address: Address) = launchAsync { | ||
val database = databaseSource.getDatabase() | ||
database.addressQueries.delete(address.id) | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
## Run | ||
|
||
``` | ||
./gradlew run | ||
./gradlew :app:run | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# About | ||
|
||
The server can be used both as a backend and a middle layer for the Web target (if such a configuration is included). When the Web client is included, the backend module will have extra commands configured to correctly run and assemble the server with web content served at the root context path (i.e., single-page application). | ||
|
||
# Links | ||
|
||
- [Official Site](https://ktor.io) | ||
- [Integration Guide](https://ktor.io/docs/server-create-a-new-project.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Usage | ||
|
||
## Overview | ||
|
||
Module: `backend` | ||
|
||
The server is configured to run on port **8080**. | ||
To change this behavior, edit the configuration file `backend/src/main/resources/application.yaml`. | ||
|
||
## Run standalone server | ||
|
||
To debug your changes: | ||
|
||
``` | ||
./gradlew :backend:run | ||
``` | ||
|
||
## Run SPA application | ||
|
||
If you included the Web platform, the backend module provides a few extra Gradle commands: | ||
|
||
- `./gradlew :backend:runDevSPA` - Runs your **backend** module with the **web** module included (debug build) to serve content at the root context path. | ||
- `./gradlew :backend:runProdSPA` - Runs your **backend** module with the **web** module included (production build) to serve content at the root context path. | ||
- `./gradlew :backend:assembleSPA` - Assembles your **backend** module with the **web** module included (production build). |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Usage | ||
|
||
## Run | ||
|
||
``` | ||
./gradlew :app:jsBrowserRun | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
apply from: "${project.rootDir}/gradle/kotlin/processor.gradle" | ||
|
||
group = 'com.kotlitecture.kotli' | ||
version = '0.2.1' | ||
version = '0.3.0' |
Oops, something went wrong.