Coder Social home page Coder Social logo

backend's Introduction

Alumna Backend: Towards a software architecture that is easier, technology agnostic and future-proof

npm npm

Alumna Backend is a NodeJS/Bun back-end framework which is the first implementation of a new software architecture concept, which provides abstraction of all layers involved, including protocols.

It is the first experiment based on a variation of continuous passing style, present on many frameworks like Express, but heavily inspired by FeathersJS, but recreating the internals from scratch as well as leaving the call stack linear, implementing a "linear continuous passing style" concept.

Install and basic usage

Step 1

Install it using your prefered package manager. The command below considers npm:

npm install @alumna/backend

Step 2

Import the library and create the endpoints:

// import the library
import Alumna from '@alumna/backend';

// import services types, e.g.
import MysqlService from './services/MysqlService.js'
import MemoryService from './services/MemoryService.js'

// import hooks (application and business rules), e.g.
import UserHooks from './hooks/UserHooks'

//
// create a instance for your backend
const backend = new Alumna();

// create as many services as you want
backend.use( 'users', new MysqlService() )
backend.use( 'tasks', new MysqlService() )
backend.use( 'messages', new MemoryService() )

// apply as many hooks as you want
backend.service( 'users' ).hooks( UserHooks )

//
// start listening for requests
backend.listen()

Service API

You can implement just the methods you want

class ExampleService {
	
	constructor() {}

	async find () {}

	async get( id, params ) {}

	async create ( data ) {}

	async update( id, data ) {}
	
	async patch( id, data ) {}
	
	async remove( id ) {}

	async setup ( app, path ) {}

}

export default ExampleService;

Hook API

Hooks are created to apply application or business rules to one or more services (or even the whole application, when its the case)

import exampleHook from './hooks/example.js'
import anotherHook from './hooks/another.js'
import errorHook from './hooks/error.js'

export default {
	before: {
		all: [],
		find: [ exampleHook ],
		get: [ anotherHook, exampleHook ],
		create: [],
		update: [],
		patch: [],
		remove: []
	},

	after: {
		all: [],
		find: [],
		get: [],
		create: [],
		update: [],
		patch: [],
		remove: []
	},

	error: {
		all: [ errorHook ],
		find: [],
		get: [],
		create: [],
		update: [],
		patch: [],
		remove: []
	}
};

Roadmap

Site and documentation

  • Create basic documentation on README
  • Create website
  • Create complete documentation on website

backend's People

Contributors

jampix avatar paulocoghi avatar

Stargazers

 avatar

Watchers

 avatar  avatar

backend's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.