chore: adjust README.md

This commit is contained in:
Maulana Sodiqin
2025-04-07 20:08:26 +07:00
parent eb05ea5994
commit 054f0f63ff
7 changed files with 125 additions and 48 deletions
Generated
+4
View File
@@ -1871,6 +1871,10 @@ dependencies = [
"validator", "validator",
] ]
[[package]]
name = "imphnen-cms-service"
version = "0.1.0"
[[package]] [[package]]
name = "imphnen-dimentorin-service" name = "imphnen-dimentorin-service"
version = "0.1.0" version = "0.1.0"
+75 -46
View File
@@ -1,78 +1,107 @@
# Axum SurrealDB Boilerplate # IMPHNEN Backend Service
## Features <p align="center">
<img src="docs/logo.svg" alt="IMPHNEN">
</p>
- **Authentication Ready**: Preconfigured authentication and middleware for secure API access. This repository serves as the **monorepo** for all backend services of IMPHNEN. It encompasses several main services:
- **Database Integration**: SurrealDB seamlessly integrated as an Axum Extension.
- **CORS Handling**: Fine-tuned CORS management with Tower HTTP `CorsLayer`.
- **API Documentation**: Fully documented with OpenAPI and Swagger UI.
- **Optimized for Performance**: Asynchronous, lightweight, and scalable architecture.
## Prerequisites 1. **Core Service** - Provides fundamental functionalities and shared resources for other services.
2. **IAM Service** - Handles identity and access management across IMPHNEN applications.
3. **CMS Service** - Supports the cms services by IMPHNEN [Landing Page website](https://imphnen.dev/).
4. **Gacha Service** - Supports the gacha services by IMPHNEN [Gacha website](https://gacha.imphnen.dev/).
5. **Dimentorin Service** - Supports the mentoring services by IMPHNEN [Dimentorin website](https://dimentorin.imphnen.dev/).
6. **Gateway Service** - Acts as the API gateway, routing requests to appropriate services.
- **Rust**: Install Rust from [rust-lang.org](https://www.rust-lang.org/). ## How to Install
- **Database**: Set up a SurrealDB instance and configure connection details.
- **Docker**: Required for containerized deployment, install from [docker.com](https://www.docker.com/).
- **Nix (Optional)**: For reproducible builds, install from [nixos.org](https://nixos.org/).
## Getting Started 1. **Clone the repository**:
1. **Clone the Repository**: ```sh
git clone https://github.com/IMPHNEN/imphnen-backend-service.git
cd imphnen-backend-service
```
- `git clone https://github.com/maulanasdqn/axum-surrealdb-boilerplate` 2. **Set up the environment**:
2. **Set Up Environment Variables**: - Copy the example environment files:
- Copy `.env.example` and rename it to `.env` ```sh
cp .env.example .env
```
- **Windows**: Run the script: `./apply-env.ps1` if you use windows based system
- **Unix-based systems (Linux, macOS, BSD)**: Run the script: `./apply-env.sh`
3. **Install Dependencies**: ```sh
./apply-env.ps1
```
- `cargo install .` if you use unix based system
4. **Setup Database**: ```sh
sh apply-env.sh
```
- Install the surrealDB - Modify the `.env` files with your specific configuration settings.
- **Windows**: `iwr https://windows.surrealdb.com -useb | iex`
- **Unix-based systems (Linux, macOS, BSD)**: `curl -sSf https://install.surrealdb.com | sh`
- Start the database `surreal start --user root --pass root`
5. **Start the Server**: 3. **Install dependencies**:
- Install Cargo Watch `cargo install cargo-watch` Ensure you have [Rust](https://www.rust-lang.org/) installed. Then, run:
- Run it with cargo watch `cargo watch -x run`
The API will be available at `http://localhost:3000/docs`. ```sh
cargo build
```
## Docker ## How to Run
1. **Build the Docker Image**: ### Development
2. **Run the Docker Container**: To run the services in development mode:
The API will be accessible at `http://localhost:3000/docs`. 1. **Start the database and other dependencies** using Docker Compose:
## Using Nix as Builder (Optional) ```sh
docker-compose up -d
```
1. **Install Nix**: 2. **Run the desired service**. For example, to run the Core Service:
2. **Enter Nix Shell or Use Nix Flakes**: ```sh
cargo run -p imphnen-core-service --bin api
```
3. **Build the Project**: ### Production
4. **Run the Server**: For production deployment:
## Contributing 1. **Build the Docker image**:
Contributions are welcome! Fork the repository and create a pull request with your improvements. ```sh
docker build -t imphnen-backend-service .
```
## License 2. **Run the Docker container**:
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. ```sh
docker run -d --env-file .env -p 8080:8080 imphnen-backend-service
```
## Acknowledgements Adjust the port and environment variables as needed.
- [Axum](https://github.com/tokio-rs/axum) ## How to Contribute
- [SurrealDB](https://github.com/surrealdb/surrealdb)
1. **Fork the repository** and clone it locally.
2. **Create a new branch** for your feature or fix:
```sh
git checkout -b feat/your-feature-name
```
3. **Make your changes**, commit them, and push to your forked repository.
4. **Create a pull request** to the `develop` branch of this repository.
If you encounter any issues or have questions, feel free to create a new issue in the repository.
---
_Note: For detailed API documentation, please refer to our [API Docs](https://api.imphnen.dev/docs)._
+8
View File
@@ -6,3 +6,11 @@ services:
ports: ports:
- "${PORT}:${PORT}" - "${PORT}:${PORT}"
env_file: ".env" env_file: ".env"
depends_on:
- surrealdb
surrealdb:
image: surrealdb/surrealdb:latest
command: start --log trace --user root --pass root
ports:
- "8000:8000"
+9
View File
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 351 KiB

+24
View File
@@ -0,0 +1,24 @@
[package]
name = "imphnen-cms-service"
version = "0.1.0"
edition = "2024"
[dependencies]
imphnen-entities = { version = "0.1.0", path = "../imphnen-entities" }
imphnen-libs = { version = "0.1.0", path = "../imphnen-libs" }
imphnen-utils = { version = "0.1.0", path = "../imphnen-utils" }
axum.workspace = true
serde.workspace = true
serde_json.workspace = true
utoipa.workspace = true
lazy_static.workspace = true
regex.workspace = true
validator.workspace = true
axum-test.workspace = true
surrealdb.workspace = true
rand.workspace = true
tokio.workspace = true
chrono.workspace = true
anyhow.workspace = true
tower-http.workspace = true
utoipa-swagger-ui.workspace = true
+3
View File
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}
+2 -2
View File
@@ -4,9 +4,10 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
imphnen-entities = { version = "0.1.0", path = "../imphnen-entities" }
imphnen-libs = { version = "0.1.0", path = "../imphnen-libs" } imphnen-libs = { version = "0.1.0", path = "../imphnen-libs" }
imphnen-utils = { version = "0.1.0", path = "../imphnen-utils" } imphnen-utils = { version = "0.1.0", path = "../imphnen-utils" }
imphnen-entities = { version = "0.1.0", path = "../imphnen-entities" }
imphnen-gateway-service = { version = "0.1.0", path = "../imphnen-gateway-service" }
axum.workspace = true axum.workspace = true
serde.workspace = true serde.workspace = true
serde_json.workspace = true serde_json.workspace = true
@@ -22,4 +23,3 @@ chrono.workspace = true
anyhow.workspace = true anyhow.workspace = true
tower-http.workspace = true tower-http.workspace = true
utoipa-swagger-ui.workspace = true utoipa-swagger-ui.workspace = true
imphnen-gateway-service = { version = "0.1.0", path = "../imphnen-gateway-service" }