diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..8d925f3 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,29 @@ +# ᗊ Ingest Documentation + +Welcome to the Ingest documentation! Ingest is an unopinionated, +event-driven, pluggable, serverless framework designed for building +modern web applications. + +## Documentation Structure + +- [Getting Started](./getting-started.md) - Quick start guide and installation +- [Core Concepts](./core-concepts.md) - Understanding Ingest's fundamental concepts +- [Features](./features.md) - Detailed overview of framework features +- [API Reference](./api-reference.md) - Complete API documentation +- [Examples](./examples.md) - Code examples and use cases +- [Contributing](./contributing.md) - Guidelines for contributing to Ingest + +## Quick Links + +- [GitHub Repository](https://github.com/yourusername/ingest) +- [NPM Package](https://www.npmjs.com/package/@stackpress/ingest) +- [Issue Tracker](https://github.com/yourusername/ingest/issues) + +## Support + +If you need help or have questions, please: +1. Check the documentation +2. Look for existing issues +3. Create a new issue if needed + +Last updated: December 18, 2024 diff --git a/docs/api-reference.md b/docs/api-reference.md new file mode 100644 index 0000000..998ae94 --- /dev/null +++ b/docs/api-reference.md @@ -0,0 +1,91 @@ +# API Reference + +## HTTP Server + +### Server Creation +```javascript +import { server } from '@stackpress/ingest/http'; +const app = server(); +``` + +### Route Handlers + +#### GET Routes +```javascript +app.get(path: string, handler: RouteHandler) +``` + +#### POST Routes +```javascript +app.post(path: string, handler: RouteHandler) +``` + +#### PUT Routes +```javascript +app.put(path: string, handler: RouteHandler) +``` + +#### DELETE Routes +```javascript +app.delete(path: string, handler: RouteHandler) +``` + +### Response Methods + +#### HTML Response +```javascript +res.setHTML(content: string) +``` + +#### JSON Response +```javascript +res.json(data: any) +``` + +#### Status Codes +```javascript +res.status(code: number) +``` + +### Request Object + +#### Properties +- `req.url`: URL of the request +- `req.method`: HTTP method +- `req.headers`: Request headers +- `req.query`: Query parameters +- `req.body`: Request body (for POST/PUT requests) + +### Middleware + +```javascript +app.use(middleware: MiddlewareFunction) +``` + +### Server Lifecycle + +```javascript +const server = app.create() +server.listen(port: number) +``` + +## Plugin System + +### Creating Plugins +```javascript +export default function myPlugin(options) { + return { + name: 'my-plugin', + setup(app) { + // Plugin setup code + } + } +} +``` + +### Using Plugins +```javascript +app.use(myPlugin(options)) +``` + +For practical examples of API usage, refer to the [Examples](./examples.md) section. diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 0000000..c7288e0 --- /dev/null +++ b/docs/contributing.md @@ -0,0 +1,82 @@ +# Contributing to Ingest + +We love your input! We want to make contributing to Ingest as easy +and transparent as possible. + +## Development Process + +1. Fork the repo +2. Clone your fork +3. Create a new branch +4. Make your changes +5. Submit a pull request + +## Project Setup + +```bash +# Clone your fork +git clone https://github.com/YOUR_USERNAME/ingest.git + +# Install dependencies +yarn install + +# Run tests +yarn test +``` + +## Development Workflow + +1. Create a feature branch: +```bash +git checkout -b feature/amazing-feature +``` + +2. Make your changes + +3. Run tests: +```bash +yarn test +``` + +4. Commit your changes: +```bash +git commit -m "Add amazing feature" +``` + +5. Push to your fork: +```bash +git push origin feature/amazing-feature +``` + +6. Open a Pull Request + +## Pull Request Process + +1. Update documentation +2. Update tests +3. Ensure CI passes +4. Get code review +5. Merge after approval + +## Code Style + +- Use TypeScript +- Follow ESLint rules +- Write meaningful commit messages +- Document new features +- Add tests for new functionality + +## License + +By contributing, you agree that your contributions will be licensed +under the project's license. + +## Questions? + +Feel free to open an issue for: +- Bug reports +- Feature requests +- Documentation improvements +- General questions + +Thank you for contributing to Ingest! diff --git a/docs/core-concepts.md b/docs/core-concepts.md new file mode 100644 index 0000000..b914a96 --- /dev/null +++ b/docs/core-concepts.md @@ -0,0 +1,50 @@ +# Core Concepts + +Ingest is built on several fundamental concepts that make it powerful +and flexible. + +## Unopinionated Design + +Ingest doesn't force you into specific patterns or structures. +You're free to: +- Organize your code as you see fit +- Choose your preferred tools and libraries +- Implement your own architectural patterns + +## Event-Driven Architecture + +The framework is built around an event-driven model: +- Events are the primary mechanism for communication +- Handlers respond to specific events +- Asynchronous processing is first-class + +## Pluggable System + +Extend functionality through plugins: +- Add new features without modifying core code +- Share reusable components +- Create custom middleware + +## Serverless First + +Designed with serverless deployment in mind: +- Stateless by default +- Quick cold starts +- Efficient resource usage + +## File-Based Routing + +Organize your routes using the filesystem: +- Intuitive directory structure +- Automatic route generation +- Clean separation of concerns + +## Type Safety + +Built with TypeScript for better development experience: +- Full type definitions +- Compile-time checks +- Better IDE support + +For practical examples of these concepts, +see the [Examples](./examples.md) section. diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 0000000..497536c --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,100 @@ +# Examples + +This document provides various examples of using Ingest in +different scenarios. + +## Basic HTTP Server + +```javascript +// Basic HTTP server example +import { server } from '@stackpress/ingest/http'; + +const app = server(); + +app.get('/', (req, res) => { + res.setHTML('