https://github.com/maulanasdqn/wedding-api
Our Wedding API
https://github.com/maulanasdqn/wedding-api
axum best-practices dcoker rust sea-orm sqlx wedding wedding-rsvp
Last synced: 6 months ago
JSON representation
Our Wedding API
- Host: GitHub
- URL: https://github.com/maulanasdqn/wedding-api
- Owner: maulanasdqn
- Created: 2024-11-11T11:18:25.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-12-08T13:55:09.000Z (6 months ago)
- Last Synced: 2024-12-08T14:33:11.900Z (6 months ago)
- Topics: axum, best-practices, dcoker, rust, sea-orm, sqlx, wedding, wedding-rsvp
- Language: Rust
- Homepage: https://api.wedding.fenny.me
- Size: 222 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Wedding Reservation API
This project is a Wedding Reservation API built using Rust.
## Features
- **RESTful API**: Provides endpoints for managing wedding reservations.
- **Database Integration**: Employs SeaORM for seamless database interactions.
- **Authentication**: Authentication and Middleware
- **CORS Handling**: Handling CORS with Tower HTTP CorsLayer
- **API Docs**: OpenAPI Swager Ready
- **Object Storage**: Integrated with Minio## Prerequisites
- **Rust**: Ensure that Rust is installed on your system. You can install it from [rust-lang.org](https://www.rust-lang.org/).
- **Database**: Set up a SurrealDB database and note the connection details, You can install it from [surrealdb.com](https://surrealdb.com/)
- **Docker**: if you want build this project using docker, you need docker, You can install it from [docker.com](https://www.docker.com/)
- **Nix**: if you want build this project using nix, you need nix, You can install it from [nixos.org](https://nixos.org/)## Getting Started
1. **Clone the Repository**:
```bash
git clone https://github.com/maulanasdqn/wedding-api.git
cd wedding-api
```2. **Set Up Environment Variables**:
Copy a `.env.exanple` file:
```env
cp .env.example .env
```3. **Install Dependencies**:
```bash
cargo build --release
```
```bash
cargo install sea-orm-cli
```4. **Run Database Migrations**:
```bash
sea-orm-cli -d .migration migrate up
```5. **Start the Server**:
```bash
cargo run -p api --release
```The API will be accessible at `http://localhost:3000/api/docs`.
## Docker
1. **Build the Docker Image**:
```bash
docker build -t wedding-api .
```2. **Run the Docker Container**:
```bash
docker run -p 3000:3000 --env-file .env wedding-api wedding-api:latest
```The API will be accessible at `http://localhost:3000/api/docs`.
## Using Nix as Builder
1. **Install Nix**:
```bash
curl -L https://nixos.org/nix/install | sh
```2. **Switch to Nix Shell or Nix Flake**:
```bash
nix develop
```3. **Build the Project**:
```bash
nix build
```4. **Run the Server**:
```bash
nix run
```## Endpoints
- **API Docs**
`http://localhost/3000/api/docs`
- **Get Reservations**
- `http://localhost:3000/api/reservations`
- **Create Reservation**
`http://localhost:3000/api/reservations/create`
- **Upload Files** `http://localhost:3000/api/upload`## Contributing
Contributions are welcome! Please fork the repository and create a pull request with your changes.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Acknowledgements
- [Axum](https://github.com/tokio-rs/axum)
- [SeaORM](https://github.com/SeaQL/sea-orm)
- [SurealDB](https://surrealdb.com)