This is a clean architecture actix-web project.
-
Just lottery hero for HOK, the old project for this
-
I hava kotlin SpringBoot project as some logic hok-lottery
See the API documentation pages for more info.
See lottery sql info for more sql info
-
Create database and tables, you can see it by lottery sql. this can be done in the terminal, then input your mysql root password:
mysql -u root -p lottery < ./sql/lottery.sql
-
Create a
.env
file in this directory:SERVER_ADDR=127.0.0.1:8034 DATABASE_URL=mysql://<username>:<password>@localhost:3306/lottery
-
Run the server
my actix Onion Architecture
:
src
├── api
│ ├── controllers
│ └── dto
├── domain
│ ├── models
│ ├── repositories
│ └── services
├── infrastructure
│ └── repositories
├── services
├── tests
│ └── api
└── main.rs
My ideal architecture in my project would be:
![](https://private-user-images.githubusercontent.com/60456779/290529549-814491fd-7d2c-408d-a90a-5672ff7ca40e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2Njc4MDgsIm5iZiI6MTcyMzY2NzUwOCwicGF0aCI6Ii82MDQ1Njc3OS8yOTA1Mjk1NDktODE0NDkxZmQtN2QyYy00MDhkLWE5MGEtNTY3MmZmN2NhNDBlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE0VDIwMzE0OFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNhMzJjOGQ5YmNhMmFmM2JiZmVlMDc1MzM5OTY3ZjQ4OTFkODQyZDZmYjlmMDg5NmUyN2Q5ZTNiY2E5NjQ0OTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.u1QBWymu6LWhZaZXGEr40oD7qA81hA09ABjAjhWui-o)
To run the tests, you can go src/tests
and use the following command:
cargo test
cargo fmt
cargo clippy