1
1
# E-Bills
2
2
3
- Core for Bitcredit project.
3
+ Core for Bitcredit E-Bills project.
4
4
5
- ### Backend
5
+ ### Crates
6
6
7
- Make sure to have at least Rust version 1.85 as well as a recent version of the toolchain installed.
7
+ The project consists of the following crates:
8
8
9
- #### On Ubuntu
10
- ``` bash
11
- # Install libs
12
- sudo apt install -y libclang-dev pkg-config build-essential
13
- ```
14
-
15
- #### On Fedora
16
- ``` bash
17
- # Install libs
18
- sudo dnf install -y make automake gcc gcc-c++ kernel-devel clang-devel
19
- sudo dnf install -y pkgconf-pkg-config @development-tools
20
- ```
21
-
22
- #### On Windows
23
- ``` bash
24
- # Using MSYS2 terminal
25
- pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-llvm
26
- pacman -S base-devel pkgconf
27
- ```
28
-
29
- Finally build the backend
30
- ``` bash
31
- cargo build
32
-
33
- # or with embedded db
34
- cargo build --features embedded-db
35
- ```
36
-
37
- Start the backend server in development mode:
38
-
39
- ``` bash
40
- # Run with defaults
41
- RUST_LOG=info cargo run
42
-
43
- # configure listening ports and addresses
44
- RUST_LOG=info cargo run -- --http-port 8001 --http-address 0.0.0.0
45
-
46
- # Run with embedded database feature, data stored in data/surreal
47
- cargo run --features embedded-db -- --surreal-db-connection rocksdb://data/surreal
48
- ```
9
+ * ` bcr-ebill-core ` - core data models and traits
10
+ * ` bcr-ebill-persistence ` - persistence traits and SurrealDB implementation
11
+ * ` bcr-ebill-transport ` - network transport traits and Nostr implementation
12
+ * ` bcr-ebill-api ` - API of the E-Bills project, contains most of the business logic
13
+ * ` bcr-ebill-web ` - Entrypoint for Web applications using the Rocket web server
14
+ * ` bcr-ebill-pwa ` - Entrypoint for WASM-based Progress Web Apps
49
15
16
+ ### Entrypoints
50
17
51
- ### Development
52
-
53
- Start the app in development mode with hot reloading
54
- (requires two terminals):
55
-
56
- ``` bash
57
- RUST_LOG=info cargo watch -x run # watch can be installed with cargo install cargo-watch
58
- ```
18
+ There are both ` WASM ` and ` Web ` entry points into the API. You can find the documentation to build and configure them [ here] ( docs/index.md ) :
59
19
60
20
### Tests
61
21
62
- You can run the existing tests using the following commands:
22
+ You can run the existing tests using the following commands in the project root :
63
23
64
24
``` bash
65
25
// without logs
@@ -69,88 +29,6 @@ cargo test
69
29
RUST_LOG=info cargo test -- --nocapture
70
30
```
71
31
72
- ### API docs
73
-
74
- OpenApi specs and a Swagger UI are available at [ http://localhost:8000/swagger-ui/ ] ( http://localhost:8000/swagger-ui/ ) when running the service.
75
-
76
- ### Docker
77
-
78
- The docker build requires no dependencies other than docker or podman. It can
79
- also be used to run multiple instances of the app on different ports for testing
80
- the P2P functionality.
81
-
82
- #### Build a standalone docker image
83
-
84
- Build the image:
85
-
86
- ``` bash
87
- # The image name can be changed to whatever you want
88
- docker build -t < image-name> .
89
- ```
90
-
91
- Launch the image:
92
-
93
- ``` bash
94
- docker run -p 8000:8000 -p 1908:1908 -e RUST_LOG=info < image-name>
95
- ```
96
-
97
- You should be able to open the app at [ http://127.0.0.1:8000/ ] ( [http://127.0.0.1:8000/] )
98
-
99
- #### Run with docker-compose
100
-
101
- Build and launch the app with docker-compose running on a different port than
102
- the default 8000:
103
-
104
- ``` bash
105
- # run in foreground, can be stopped using CTRL+C
106
- docker-compose up
107
-
108
- # run in background, can be stopped using docker-compose stop
109
- docker-compose up -d
110
-
111
- # rebuild the image
112
- docker-compose build
113
- ```
114
-
115
- If you use the above commands, the application state (identity, bills, contacts)
116
- will persist between sessions. However, if you use ` docker-compose down ` , or
117
- ` docker-compose rm ` , the existing container gets removed, along with it's state.
118
- Of course, rebuilding the image also removes the application state.
119
-
120
- ### SurrealDB
121
-
122
- For development it is advised to use a local SurrealDB instance running as a
123
- separate service as compile times are quite long. In production builds SurrealDB
124
- will be available as an embedded database in the application. SurrealDB listens
125
- on port 8000 by default which is the same as the default port for the application
126
- so make sure to change the SurrealDB port or application port before running the
127
- services.
128
-
129
- #### Connect to SurrealDB
130
-
131
- When the application has been built with the ` embedded-db ` feature, it allows to
132
- use the application with a ` rocksdb://path/to/db ` connection string otherwise you
133
- need to connect the the database via web-socket like: ` ws://localhost:8800 ` .
134
-
135
- #### Run SurrealDB for development
136
-
137
- ``` bash
138
- # build the application with surrealdb embedded
139
- cargo build --features embedded-db
140
-
141
- # start surrealdb container included in docker-compose.yml (listening 8800)
142
- docker-compose up -d surrealdb
143
-
144
- # with surrealdb installed on your local machine (listening on port 8800)
145
- surrealdb start --unauthenticated --bind 127.0.0.1:8800
146
- ```
147
-
148
- #### Explore the database with Surrealist
149
-
150
- To work with and explore the database, you can use
151
- [ Surrealist] ( https://surrealdb.com/surrealist ) which is an interactive interface
152
- for SurrealDB.
153
-
154
32
## Contribute
155
33
156
34
Check out the project [ contributing guide] ( ./CONTRIBUTING.md ) .
0 commit comments