@foxframework/core
Version:
A modern, production-ready web framework for TypeScript/Node.js with modular routing, integrated template engine, CLI tools, and enterprise features
220 lines (168 loc) โข 5.85 kB
Markdown
# ๐ฆ Fox Framework
[](https://www.npmjs.com/package/@foxframework/core)
[](https://opensource.org/licenses/MIT)
[](https://github.com/lnavarrocarter/fox-framework/actions)
[](http://www.typescriptlang.org/)
A **modern, production-ready web framework** for TypeScript/Node.js with enterprise features, modular architecture, and integrated DevOps tooling.
## ๐ **Quick Start**
### Installation
```bash
npm install @foxframework/core
```
### Create a New Project
```bash
npx tsfox new my-app
cd my-app
npm run dev
```
### Basic Usage
```typescript
import { FoxFactory } from '@foxframework/core';
const app = FoxFactory.create({
requests: [
{
path: '/',
method: 'get',
handler: (req, res) => res.json({ message: 'Hello Fox!' })
}
]
});
app.listen(3000, () => {
console.log('๐ฆ Fox Framework running on port 3000');
});
```
## โจ **Features**
### ๐๏ธ **Core Framework**
- **TypeScript-first** with full type safety
- **Modular routing** with factory patterns
- **Integrated template engine** (Fox + Handlebars)
- **Middleware pipeline** with async support
- **Error handling** with custom error types
### ๐ ๏ธ **Developer Experience**
- **CLI tools** for project generation
- **Hot reload** in development
- **Testing utilities** with Jest integration
- **TypeScript decorators** support
### ๐ข **Enterprise Features**
- **Microservices** architecture support
- **Circuit breaker** patterns
- **Load balancing** algorithms
- **Service discovery** and registry
- **Health checks** and monitoring
### ๐ **Security**
- **Authentication** middleware
- **Authorization** with role-based access
- **CSRF protection**
- **Security headers** middleware
- **Rate limiting**
### ๐ **Observability**
- **Structured logging** with multiple transports
- **Metrics collection** (Prometheus format)
- **Performance monitoring**
- **Health check endpoints**
- **Request tracing**
### ๐๏ธ **Data & Caching**
- **Database abstraction** layer
- **Multi-provider caching** (Memory, Redis, File)
- **Response caching** middleware
- **Cache invalidation** strategies
### ๐ **DevOps Ready**
- **Docker** multi-stage builds
- **Docker Compose** for local development
- **CI/CD** GitHub Actions workflows
- **Kubernetes** deployment manifests
- **Monitoring** stack (Prometheus + Grafana)
## ๐ **Documentation**
Visit our [complete documentation](https://github.com/lnavarrocarter/fox-framework/docs) for detailed guides and API reference.
### Quick Examples
#### REST API
```typescript
import { FoxFactory } from '@foxframework/core';
const app = FoxFactory.create({
requests: [
{ path: '/users', method: 'get', handler: getAllUsers },
{ path: '/users', method: 'post', handler: createUser },
{ path: '/users/:id', method: 'get', handler: getUser },
{ path: '/users/:id', method: 'put', handler: updateUser },
{ path: '/users/:id', method: 'delete', handler: deleteUser }
]
});
```
#### With Middleware
```typescript
import { FoxFactory, authMiddleware, loggingMiddleware } from '@foxframework/core';
const app = FoxFactory.create({
middleware: [
loggingMiddleware(),
authMiddleware({ secret: 'your-jwt-secret' })
],
requests: [
{ path: '/protected', method: 'get', handler: protectedRoute }
]
});
```
## ๐ ๏ธ **CLI Commands**
```bash
# Create new project
npx tsfox new <project-name>
# Generate components
npx tsfox generate controller users
npx tsfox generate service auth
npx tsfox generate middleware validation
# Docker operations
npx tsfox docker init
npx tsfox docker build
npx tsfox docker deploy
```
## ๐งช **Testing**
Fox Framework includes comprehensive testing utilities:
```typescript
import { FoxTestUtils } from '@foxframework/core';
describe('API Tests', () => {
const { request } = FoxTestUtils.createTestApp(app);
it('should return users', async () => {
const response = await request.get('/users');
expect(response.status).toBe(200);
expect(response.body).toHaveProperty('users');
});
});
```
## ๐ **Performance**
- **Lightweight**: < 50KB gzipped
- **Fast startup**: < 100ms cold start
- **High throughput**: > 10k req/s
- **Memory efficient**: < 50MB baseline
- **Scalable**: Horizontal and vertical scaling
## ๐ค **Contributing**
We welcome contributions! Please see our [Contributing Guide](https://github.com/lnavarrocarter/fox-framework/blob/main/CONTRIBUTING.md).
### Development Setup
```bash
git clone https://github.com/lnavarrocarter/fox-framework.git
cd fox-framework
npm install
npm run dev
```
### Running Tests
```bash
npm test # All tests
npm run test:unit # Unit tests only
npm run test:integration # Integration tests
npm run test:coverage # With coverage
```
## ๐ฆ **Ecosystem**
- **@foxframework/core** - Core framework (this package)
- **@foxframework/cli** - Extended CLI tools
- **@foxframework/plugins** - Community plugins
- **@foxframework/templates** - Project templates
## ๐ **License**
MIT ยฉ [Luis Navarro Carter](https://github.com/lnavarrocarter)
## ๐ **Links**
- [๐ Documentation](https://github.com/lnavarrocarter/fox-framework/docs)
- [๐ Issues](https://github.com/lnavarrocarter/fox-framework/issues)
- [๐ฌ Discussions](https://github.com/lnavarrocarter/fox-framework/discussions)
- [๐ฆ NPM Package](https://www.npmjs.com/package/@foxframework/core)
---
<p align="center">
<strong>๐ฆ Built with Fox Framework</strong><br>
<em>Modern, Fast, Production-Ready</em>
</p>