Skip to content

Commit ecff272

Browse files
committed
docs: update README.md
1 parent 5ca27e6 commit ecff272

File tree

2 files changed

+101
-67
lines changed

2 files changed

+101
-67
lines changed

README.md

Lines changed: 100 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,124 @@
11
# Jazzy Framework
22

3-
Jazzy is a lightweight web framework for Java. It provides a minimal and easy-to-understand API for developing fast web applications.
3+
Jazzy is a lightweight web framework for Java. It provides a minimal and easy-to-understand API for developing fast web applications with a structure inspired by Laravel.
44

55
## Features
66

77
- Simple and intuitive API
88
- Routing system with HTTP method support (GET, POST, PUT, DELETE, PATCH)
99
- URL path parameter support
10-
- Automatic parameter mapping
11-
- Simple metrics collection and reporting
10+
- Request validation with comprehensive rules
11+
- JSON response generation with fluent API
12+
- Metrics collection and reporting
1213

1314
## Quick Start
1415

1516
To develop a web application with Jazzy, you can follow this example code:
1617

1718
```java
1819
// App.java
19-
package com.example;
20+
package examples.basic;
2021

2122
import jazzyframework.core.Config;
2223
import jazzyframework.core.Server;
2324
import jazzyframework.routing.Router;
2425

25-
public class App {
26-
public static void main(String[] args) {
27-
// Create configuration
26+
public class App
27+
{
28+
public static void main( String[] args )
29+
{
2830
Config config = new Config();
2931
config.setEnableMetrics(true); // "/metrics" endpoint is automatically added
3032
config.setServerPort(8088);
31-
32-
// Create router
33+
3334
Router router = new Router();
3435

35-
// Define routes
36-
router.GET("/user/{id}", "getUserById", UserController.class);
37-
router.POST("/user/{id}", "updateUser", UserController.class);
36+
// User routes
37+
router.GET("/users/{id}", "getUserById", UserController.class);
3838
router.GET("/users", "getAllUsers", UserController.class);
39-
router.DELETE("/user/{id}", "deleteUser", UserController.class);
40-
router.PUT("/user/{id}", "putUser", UserController.class);
41-
39+
router.POST("/users", "createUser", UserController.class);
40+
router.PUT("/users/{id}", "updateUser", UserController.class);
41+
router.DELETE("/users/{id}", "deleteUser", UserController.class);
42+
4243
// Start the server
4344
Server server = new Server(router, config);
4445
server.start(config.getServerPort());
4546
}
4647
}
4748

4849
// UserController.java
49-
package com.example;
50+
package examples.basic;
51+
52+
import static jazzyframework.http.ResponseFactory.response;
53+
import jazzyframework.http.Request;
54+
import jazzyframework.http.Response;
55+
import jazzyframework.http.validation.ValidationResult;
56+
import java.util.Map;
5057

5158
public class UserController {
52-
// Method with path parameter
53-
public String getUserById(String id) {
54-
return "User ID: " + id;
59+
60+
public Response getUserById(Request request) {
61+
String id = request.path("id");
62+
63+
return response().json(
64+
"id", id,
65+
"name", "Fletcher Davidson",
66+
"email", "[email protected]"
67+
);
5568
}
5669

57-
// Method without parameters
58-
public String getAllUsers() {
59-
return "All users";
70+
public Response getAllUsers(Request request) {
71+
int page = request.queryInt("page", 1);
72+
int limit = request.queryInt("limit", 10);
73+
74+
return response().json(
75+
"users", JSON.array(
76+
JSON.of("id", "user-1", "name", "Fletcher Davidson"),
77+
JSON.of("id", "user-2", "name", "Jane Smith")
78+
),
79+
"page", page,
80+
"limit", limit,
81+
"total", 2
82+
);
6083
}
6184

62-
// Method with path parameter and request body
63-
public String updateUser(String id, String requestBody) {
64-
return "Updated user " + id + " with data: " + requestBody;
65-
}
66-
67-
// Method for handling DELETE requests
68-
public String deleteUser(String id) {
69-
return "Deleted user " + id;
85+
public Response createUser(Request request) {
86+
// Validate the request
87+
ValidationResult result = request.validator()
88+
.field("name").required().minLength(3).maxLength(50)
89+
.field("email").required().email()
90+
.field("password").required().minLength(8)
91+
.validate();
92+
93+
if (!result.isValid()) {
94+
return response().json(
95+
"status", "error",
96+
"message", "Validation failed",
97+
"errors", result.getAllErrors()
98+
).status(400);
99+
}
100+
101+
Map<String, Object> userData = request.parseJson();
102+
103+
// Generate a new ID
104+
String newId = "user-" + System.currentTimeMillis();
105+
userData.put("id", newId);
106+
107+
return response().success("User created successfully", userData).status(201);
70108
}
71109

72-
// Method for handling PUT requests
73-
public String putUser(String id, String requestBody) {
74-
return "Updated user " + id + " with data: " + requestBody;
75-
}
110+
// Additional methods for update and delete operations
76111
}
77112
```
78113

79114
For a more detailed example, check the `src/main/java/examples/basic` directory.
80115

116+
## Documentation
117+
118+
Complete documentation for Jazzy Framework is available on our GitHub Pages site:
119+
120+
[Jazzy Framework Documentation](https://canermastan.github.io/jazzy-framework/)
121+
81122
## Development
82123

83124
Jazzy is developed with Maven. After cloning the project, you can use the following commands:
@@ -103,6 +144,12 @@ mvn exec:java -Dexec.mainClass="examples.basic.App"
103144
- `routing/`: Routing system
104145
- `Router.java`: Route management
105146
- `Route.java`: Route data structure
147+
- `http/`: HTTP handling
148+
- `Request.java`: Request handling
149+
- `Response.java`: Response building
150+
- `ResponseFactory.java`: Factory for creating responses
151+
- `JSON.java`: JSON creation utilities
152+
- `validation/`: Validation system
106153
- `controllers/`: System controllers
107154
- `MetricsController.java`: Metrics reporting
108155
- `examples/`: Example applications
@@ -115,55 +162,42 @@ Unit tests have been written to ensure the reliability of the framework. Test co
115162
- `RouterTest`: Tests for adding routes, finding routes, and path parameter operations
116163
- `RouteTest`: Tests for the route data structure
117164
- `MetricsTest`: Tests for metric counters and calculations
118-
- `MetricsControllerTest`: Tests for the metrics controller
165+
- `ValidationTest`: Tests for the validation system
166+
- `ResponseFactoryTest`: Tests for response generation
119167

120168
When adding new features or modifying existing code, it's important to update existing tests or add new tests to maintain the stability of the framework.
121169

122-
## Vision and Roadmap
123-
124-
Jazzy aims to simplify Java web development with a low learning curve, inspired by the elegance and developer-friendliness of Laravel in the PHP world. Our mission is to create a framework that enables developers to quickly build production-ready applications without the typical complexity associated with Java web frameworks.
125-
126-
We believe Java development doesn't have to be verbose or complicated. By bringing Laravel-like simplicity and expressiveness to Java, we want to make web development more accessible and enjoyable for Java developers.
170+
## Roadmap
127171

128-
Key principles:
129-
- Simplicity over complexity
130-
- Convention over configuration
131-
- Rapid development without sacrificing performance
132-
- Low learning curve for developers new to Java or web development
172+
Jazzy is actively being developed with the following features planned for upcoming releases:
133173

134-
## Future Features
174+
### Upcoming Features
135175

136-
### Core Improvements
137-
- JSON support with automatic serialization/deserialization
138-
- Simple template engine
139-
- Middleware system
140-
- Form validation
141-
- Database integration with simple ORM
176+
- **Middleware System**: Support for request/response middleware chains
177+
- **Database Integration**: jOOQ integration for type-safe SQL queries
178+
- **Dependency Injection**: Custom DI container (PococContainer) with `@Named` and `@Qualified` annotations
179+
- **Security Framework**: Authentication and authorization system
180+
- **Caching System**: Redis integration for high-performance caching
181+
- **API Documentation**: Swagger/OpenAPI integration
182+
- **WebSocket Support**: Real-time bidirectional communication
183+
- **Task Scheduling**: Cron-style job scheduling
184+
- **Monitoring Tools**: Health checks and system monitoring
185+
- **File Storage**: Cloud storage integrations (S3, etc)
186+
- **Event System**: Pub/sub event handling
187+
- **CLI Tools**: Command line tools for code generation
188+
- **And More...**: Stay tuned for additional features!
142189

143-
### Developer Experience
144-
- Centralized routing configuration (similar to Laravel's routes.php)
145-
- Authentication system with easy JWT integration
146-
- Simple project setup and scaffolding
147-
- Comprehensive documentation with examples
148190

149191
## Contributing
150192

151193
**Jazzy is actively maintained and we welcome contributions of any size!**
152194

153195
We believe that open source thrives with community involvement, and we appreciate all types of contributions, whether you're fixing a typo, improving documentation, adding a new feature, or reporting a bug.
154196

155-
### Ways to Contribute
156-
157-
- **Code Contributions**: New features, bug fixes, performance improvements
158-
- **Documentation**: Improving README, adding examples, writing tutorials
159-
- **Testing**: Adding new tests, improving existing tests
160-
- **Feedback**: Reporting bugs, suggesting features
161-
- **Spreading the Word**: Telling others about Jazzy
162-
163197
### Getting Started
164198

165199
1. Fork the project
166-
2. Clone your fork (`git clone https://github.com/yourusername/jazzy.git`)
200+
2. Clone your fork (`git clone https://github.com/canermastan/jazzy-framework.git`)
167201
3. Create a feature branch (`git checkout -b feature/amazing-feature`)
168202
4. Make your changes (don't forget to add tests if applicable)
169203
5. Run tests to make sure everything works (`mvn test`)

docs-site/docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const config = {
1818
url: 'https://jazzyframework.com',
1919
// Set the /<baseUrl>/ pathname under which your site is served
2020
// For GitHub pages deployment, it is often '/<projectName>/'
21-
baseUrl: '/',
21+
baseUrl: '/jazzy-framework/',
2222

2323
// GitHub pages deployment config.
2424
organizationName: 'canermastan', // Usually your GitHub org/user name.

0 commit comments

Comments
 (0)