Welcome to the Multi-Stack Bookstore REST APIs repository! This comprehensive project demonstrates how to build consistent RESTful APIs across multiple programming languages and frameworks. Each implementation provides a complete bookstore API with CRUD operations, allowing developers to compare approaches and learn best practices across different technology stacks.
This repository aims to:
- Demonstrate RESTful API patterns across multiple languages and frameworks
- Provide practical examples for developers learning new technology stacks
- Enable easy comparison of implementation approaches between languages
- Offer migration guides for developers switching between technologies
- Showcase modern tooling and best practices for each ecosystem
The repository is organized by language and framework combinations:
rest-api-bookstore/
├── /DOCS/ # Documentation and migration guides
│ ├── NODE_TO_PYTHON.md # Node.js to Python migration guide
│ ├── NODE_TO_JAVA.md # Node.js to Java migration guide
│ ├── NODE_TO_RUST.md # Node.js to Rust migration guide
│ ├── NODE_TO_DOTNET.md # Node.js to .NET migration guide
│ ├── NODE_TO_GO.md # Node.js to Go migration guide
│ ├── api-spec.md # API specification (OpenAPI/Swagger)
│ └── postman-collection.json # Postman collection for testing
├── /nodejs-express/ # Node.js with Express framework
├── /nodejs-koa/ # Node.js with Koa framework
├── /nodejs-nest/ # Node.js with NestJS framework
├── /python-flask/ # Python with Flask framework
├── /python-fastapi/ # Python with FastAPI framework
├── /python-blacksheep/ # Python with BlackSheep framework
├── /javaspringboot/ # Java with Spring Boot framework
├── /dotnet/ # .NET with ASP.NET Core
├── /go-fiber/ # Go with Fiber framework
├── /go-echo/ # Go with Echo framework
├── /rust-rocket/ # Rust with Rocket framework
├── /rust-poem/ # Rust with Poem framework
├── /rust-wrap/ # Rust with Warp framework
├── README.md # This file
├── LICENSE # MIT License
└── .gitignore # Git ignore file
The following languages and frameworks are currently supported:
| Framework | Folder | Description |
|---|---|---|
| Express | /nodejs-express | Minimal and flexible web framework |
| Koa | /nodejs-koa | Next-generation web framework |
| NestJS | /nodejs-nest | Progressive Node.js framework |
| Framework | Folder | Description |
|---|---|---|
| Flask | /python-flask | Lightweight WSGI web framework |
| FastAPI | /python-fastapi | Modern, fast web framework |
| BlackSheep | /python-blacksheep | Fast ASGI web framework |
| Framework | Folder | Description |
|---|---|---|
| Fiber | /go-fiber | Express-inspired web framework |
| Echo | /go-echo | High performance, minimalist Go web framework |
| Framework | Folder | Description |
|---|---|---|
| Rocket | /rust-rocket | Type-safe web framework |
| Poem | /rust-poem | Full-featured web framework |
| Warp | /rust-wrap | Composable web framework |
| Framework | Folder | Description |
|---|---|---|
| Spring Boot | /javaspringboot | Production-ready Spring framework |
| Framework | Folder | Description |
|---|---|---|
| ASP.NET Core | /dotnet | Cross-platform .NET framework |
Each implementation contains:
- Complete RESTful API with CRUD operations for
books - Dedicated
README.mdwith setup and run instructions - SQLite database integration
- Consistent API endpoints and responses
All implementations provide a RESTful API for managing a bookstore’s books resource. The API supports the following CRUD operations:
| Method | Endpoint | Description |
|---|---|---|
GET |
/books |
Retrieve a list of all books. |
POST |
/books |
Create a new book. |
GET |
/books/:id |
Retrieve a book by its ID. |
PUT |
/books/:id |
Update an existing book. |
DELETE |
/books/:id |
Delete a book by its ID. |
Book Data Structure (JSON example):
{
"id": 1,
"title": "The Great Gatsby",
"author": "F. Scott Fitzgerald",
"isbn": "978-0743273565",
"price": 9.99,
"stock": 50
}- The API uses JSON for request and response bodies.
- Standard HTTP status codes are used (e.g.,
200 OK,201 Created,404 Not Found). - Each implementation uses in-memory storage or a lightweight database (e.g., SQLite, JSON file) to keep it beginner-friendly.
Switching between technology stacks? Our comprehensive migration guides help you understand the equivalents and differences:
- Node.js to Python - npm/Node.js concepts mapped to Python/uv
- Node.js to Java - npm/Node.js concepts mapped to Java/Maven
- Node.js to Rust - npm/Node.js concepts mapped to Rust/Cargo
- Node.js to .NET - npm/Node.js concepts mapped to .NET/dotnet CLI
- Node.js to Go - npm/Node.js concepts mapped to Go/go mod
Each guide covers:
- Package management equivalents
- Project initialization
- Dependency installation
- Running applications
- Environment variables
- JSON handling
- Server setup examples
- Middleware patterns
- Routing examples
Follow these steps to get started:
-
Choose Your Stack:
- Browse the Available Implementations section
- Select a language and framework combination that interests you
- Navigate to the corresponding folder
-
Follow Setup Instructions:
- Each implementation has a detailed
README.mdwith setup steps - Install the required dependencies and tools
- Run the development server
- Each implementation has a detailed
-
Test the API:
- Use the provided cURL examples in each README
- Import
/DOCS/postman-collection.jsoninto Postman for comprehensive testing - All implementations expose the same API endpoints for consistency
-
Compare Implementations:
- Try multiple frameworks within the same language
- Use the migration guides to understand differences between languages
- Compare code structure, performance, and developer experience
-
Learn from Migration Guides:
- If you're familiar with Node.js, use our migration guides to quickly understand other languages
- Each guide provides practical examples and equivalent commands
Before running the code, ensure you have the following installed (specific versions are listed in each language’s README):
- Node.js (v22 or later): For the Node.js implementation.
- Java JDK (v17 or later): For the Java implementation.
- Python (v3.12 or later): For the Python implementation.
- Docker: Optional, for running containerized versions.
- Postman: For testing APIs (or use cURL).
-
Clone the Repository:
git clone https://github.com/your-username/rest-api-bookstore.git cd rest-api-bookstore -
Choose an Implementation:
cd nodejs-express # Node.js with Express cd python-flask # Python with Flask cd javaspringboot # Java with Spring Boot cd dotnet # .NET with ASP.NET Core # ... or any other implementation
-
Follow Implementation-Specific Instructions:
- Each folder contains a detailed
README.mdwith setup steps - Install required dependencies and tools
- Run the development server
Example for Node.js Express:
cd nodejs-express yarn install yarn startExample for Python Flask:
cd python-flask poetry install ./dev.sh - Each folder contains a detailed
-
Test the API:
- Use Postman with the provided collection or run cURL commands like:
curl http://localhost:5000/api/v1/books
- Example POST request:
curl -X POST http://localhost:5000/api/v1/books \ -H "Content-Type: application/json" \ -d '{"title":"1984","author":"George Orwell","isbn":"978-0451524935","price":8.99,"stock":100}'
- Use Postman with the provided collection or run cURL commands like:
- REST Principles: /docs/rest-principles.md explains key REST concepts like statelessness, HTTP methods, and best practices for API design.
- API Specification: /docs/api-spec.md provides the OpenAPI/Swagger definition for the bookstore API, detailing endpoints and data structures.
- Postman Collection: /docs/postman-collection.json includes pre-configured requests for testing all bookstore endpoints.
Here’s how you might interact with the bookstore API (Node.js example, port 3000):
-
Get all books:
curl http://localhost:5000/api/v1/books
Response:
[ { "id": 1, "title": "The Great Gatsby", "author": "F. Scott Fitzgerald", "isbn": "978-0743273565", "price": 9.99, "stock": 50 } ] -
Create a new book:
curl -X POST http://localhost:5000/api/v1/books \ -H "Content-Type: application/json" \ -d '{"title":"1984","author":"George Orwell","isbn":"978-0451524935","price":8.99,"stock":100}'
Response:
{ "id": 2, "title": "1984", "author": "George Orwell", "isbn": "978-0451524935", "price": 8.99, "stock": 100 }
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Make your changes (e.g., add a new language, improve the bookstore API, or update docs).
- Submit a pull request with a clear description of your changes.
Please follow the Contributing Guidelines (to be added) and ensure code consistency with existing implementations.
- Found a bug? Create an issue on the Issues page.
- Have questions or suggestions? Join the Discussions for community engagement.
This project is licensed under the MIT License, making it freely available for educational use.
For questions or support, reach out via GitHub Issues or Discussions. Happy learning, and enjoy building your bookstore API!