English | 简体中文
Cell is a Serverless First, componentized, platform-independent progressive application framework based on TypeScript.
- Convention over configuration, zero configuration, ready to use out of the box
- Spring Boot for TypeScript
- Serverless First
- The platform is not locked
- Support front-end and back-end integration, and the front-end frame is not locked
- Support microservices
- Componentization, progressive
- Pluginization of command line tools
- Dependency injection
- Aspect Oriented Programming (AOP)
- Integrate with popular ORM framework and use decorator declarative transaction management
- Support OIDC certification
- Support OAuth2 authorization
- Use rxjs to manage status
- Provides two interface styles, REST and RPC
# Install command-line tools
npm install -g @celljs/cli
# Initialization
cell init -o project-name
cd project-name # Enter the project root directory
# Running
cell serve
# Deployment
cell deploy -m scf # Deploy to Tencent Cloud Function(SCF)
cell deploy -m fc # Deploy to Alibaba Cloud Function Compute(FC)
cell deploy -m lambda # Deploy to AWS Lambda
- Introduction
- Create the first application
- Command line tools
- Controller
- Database operations
- Microservice
- Authentication and authorization
- Cloud Platform Adaptation
- Dependency injection
- Component design
- Front-end architecture
- React development
- Front and back-end integrated development
// Class object injection
@Component()
export class A {
}
@Component()
export class B {
@Autowired()
protected a: A;
}
// Configuration property injection
@Component()
export class C {
@Value('foo') // Support EL expression syntax, such as @Value('obj.xxx'), @Value('arr[1]') etc.
protected foo: string;
}
import { Controller, Get, Param, Delete, Put, Post, Body } from '@celljs/mvc/lib/node';
import { Transactional, OrmContext } from '@celljs/typeorm/lib/node';
import { User } from './entity';
@Controller('users')
export class UserController {
@Get()
@Transactional({ readOnly: true })
list(): Promise<User[]> {
const repo = OrmContext.getRepository(User);
return repo.find();
}
@Get(':id')
@Transactional({ readOnly: true })
get(@Param('id') id: number): Promise<User | undefined> {
const repo = OrmContext.getRepository(User);
return repo.findOne(id);
}
@Delete(':id')
@Transactional()
async remove(@Param('id') id: number): Promise<void> {
const repo = OrmContext.getRepository(User);
await repo.delete(id);
}
@Put()
@Transactional()
async modify(@Body() user: User): Promise<void> {
const repo = OrmContext.getRepository(User);
await repo.update(user.id, user);
}
@Post()
@Transactional()
create(@Body() user: User): Promise<User> {
const repo = OrmContext.getRepository(User);
return repo.save(user);
}
}