# Geddle Rust
[Geddle](https://geddle.com) is the AI & SaaS affiliate marketplace for creators.
## Tech Stack
- **Backend**: Rust + Axum
- **Database**: PostgreSQL + clorinde
- **Payment Processing**: Stripe
- **Authentication**: JWT
- **Web Framework**: Pure Axum routing
- **Async Runtime**: Tokio
- **Connection Pooling**: Deadpool
## Getting Started
### Prerequisites
- Rust (2024 edition)
- PostgreSQL
- Stripe Account
### Setup
1. Clone the repository
```bash
git clone https://github.com/geddle/geddle-rust.git
cd geddle-rust
```
2. Create a `.env` file in the root directory with the following variables:
```
DATABASE_URL=postgres://username:password@localhost/geddle
DATA_DATABASE_URL=postgres://username:password@localhost/geddle_data
STRIPE_SECRET_KEY=sk_test_...
```
3. Run database migrations
```bash
sqlx database create
sqlx migrate run
```
4. Build the project
```bash
cargo build
```
5. Run the services
```bash
# Terminal 1: Run the API server
cargo run --bin geddle
# or use alias:
cargo dev # development mode
```
The API will be available at `http://127.0.0.1:5001`.
## Development
### Database Schema
The database schema is defined in the `migrations` directory. To add new migrations:
```bash
$ sqlx migrate add migration_name
$ sqlx migrate run
$ sqlx migrate revert # to revert the last migration (run carefully!)
```
### Code Generation
The database query code is generated using `clorinde`. After modifying SQL files in the `queries` directory, regenerate the code with:
```bash
$ cargo clean -p geddle-common # clean cache if necessary
$ cargo build -p geddle-common # build the common crate to generate geddle-db
```
## Deployment
### GitHub Actions Deployment
Deployment is handled via GitHub Actions:
1. Go to the Actions tab in GitHub
2. Select "Deploy" workflow
3. Click "Run workflow"
4. The workflow will build and deploy all services automatically
## Contributing
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request