A modern, type-safe REST API built with Rust, featuring comprehensive CRUD operations for users, profiles, and posts. Created with Windsurf, the world's first agentic IDE.
- Modern Stack: Built with Actix-web 4.x and Sea-ORM
- Type Safety: Leverages Rust's powerful type system
- Database Integration: PostgreSQL with Sea-ORM
- Clean Architecture: Repository pattern and modular design
- RESTful API: Full CRUD operations for all resources
GET /api/users # List all users
POST /api/users # Create a new user
GET /api/users/{id} # Get user by ID
PUT /api/users/{id} # Update user
DELETE /api/users/{id} # Delete user
GET /api/profiles # List all profiles
POST /api/profiles # Create a new profile
GET /api/profiles/{id} # Get profile by ID
PUT /api/profiles/{id} # Update profile
DELETE /api/profiles/{id} # Delete profile
GET /api/posts # List all posts
POST /api/posts # Create a new post
GET /api/posts/{id} # Get post by ID
PUT /api/posts/{id} # Update post
DELETE /api/posts/{id} # Delete post
- Rust (latest stable version)
- PostgreSQL
- Cargo
- Create a PostgreSQL database
- Set your database URL in the environment:
export DATABASE_URL="postgres://user:password@localhost/dbname"
- Clone the repository:
git clone <repository-url>
cd crud_from_prisma
- Install dependencies:
cargo build
- Run migrations:
cargo run --bin migration
- Start the server:
cargo run
The server will start at http://localhost:3333
src/
├── api/ # API handlers and routes
├── dto/ # Data Transfer Objects
├── entity/ # Database entities
├── repository/ # Database operations
└── server/ # Server configuration
Run the test suite:
cargo test
Generate and view the documentation:
cargo doc --open
cargo build
cargo run
cargo run --release
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'feat: Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Windsurf - The world's first agentic IDE
- Actix-web
- Sea-ORM
- PostgreSQL