Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -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
91 changes: 91 additions & 0 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
@@ -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.
82 changes: 82 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -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!
50 changes: 50 additions & 0 deletions docs/core-concepts.md
Original file line number Diff line number Diff line change
@@ -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.
100 changes: 100 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
@@ -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('<h1>Welcome to Ingest!</h1>');
});

app.create().listen(3000);
```

## File-Based Routing

```javascript
// src/server.ts
import path from 'node:path';
import { server } from '@stackpress/ingest/http';

const app = server();
app.get('/', path.join(__dirname, 'pages/home'));
app.get('/about', path.join(__dirname, 'pages/about'));
app.create().listen(3000);

// src/pages/home.ts
export default function HomePage(req, res) {
res.setHTML('<h1>Home Page</h1>');
}

// src/pages/about.ts
export default function AboutPage(req, res) {
res.setHTML('<h1>About Us</h1>');
}
```

## Using Plugins

```javascript
// Custom logger plugin
function loggerPlugin() {
return {
name: 'logger',
setup(app) {
app.use((req, res, next) => {
console.log(`${req.method} ${req.url}`);
next();
});
}
}
}

const app = server();
app.use(loggerPlugin());
```

## API Routes

```javascript
// RESTful API example
app.get('/api/users', (req, res) => {
res.json([
{ id: 1, name: 'John' },
{ id: 2, name: 'Jane' }
]);
});

app.post('/api/users', async (req, res) => {
const user = await req.json();
// Handle user creation
res.json({ success: true, user });
});
```

## Running Examples

You can run the example projects included in the repository:

```bash
# Development mode
yarn <example>:dev

# Build mode
yarn <example>:build
```

Available examples:
- `entries`: File-based routing
- `fetch`: API integration
- `http`: Basic HTTP server
- `plugins`: Plugin system

Each example in the `/examples` directory includes its own README with specific instructions.
Loading
Loading