Coder Social home page Coder Social logo

aeria-org / aeria Goto Github PK

View Code? Open in Web Editor NEW
44.0 1.0 0.0 1.18 MB

A secure backend framework.

Home Page: https://aeria.land/

License: MIT License

TypeScript 100.00%
appsec bun deno javascript mongodb node strong-typed typescript aeria low-code rapid-development

aeria's Introduction

Aeria https://github.com/aeria-org/aeria/actions/workflows/ci.yaml

Aeria Logo

router.GET('/get-pets/(\w+)', (context) => {
  return context.collections.pet.functions.getAll({
    filters: {
      name: context.request.fragments[0]
    }
  })
})

Introduction

Aeria is a backend framework tuned for the enterprise. It features everything needed to build secure and auditable environments: routing, model definition, runtime validation, rate limiting, et cetera. It also tries to combine the richness of features that will ensure a fast-paced development with a elegant and minimalist coding style that will bring joy to work time.

Features

  • 🔒 Secure by design
  • 🤌 Minimalistically crafted DX
  • ⚡ Fast reloads in watch mode with esbuild
  • 🪞 Automatic reflection of HTTP endpoints
  • 🔋 Batteries included (authentication, access control, file management, logging, etc)
  • 😱 and much more!

Quickstart

$ npm create -y aeria-app hello-world

Community

Aeria Server

Resources

aeria's People

Contributors

minenwerfer avatar github-actions[bot] avatar

Stargazers

Taj avatar Yuta Katayama avatar Renan Zapelini avatar Dante Dantas avatar Hercules Gabriel avatar Hosna Qasmei avatar Henrique Soto / Programador Aos 30 avatar Clayton Kehoe avatar Gustavo Morinaga avatar FilipeSilva avatar Leandro Santana avatar  avatar  avatar Aneil Martins avatar Dave avatar  avatar Mauricio Domingues avatar Délcio Capolo avatar Cristiano avatar Paulo Wender avatar Gustavo Henrique avatar Giovane Marcelo avatar Thiago Henrique Domingues avatar Marcos Peter avatar Max Rogério avatar Kauê Fraga Rodrigues avatar Leandro A Silva avatar Ruvian S. avatar Guilherme Neves avatar Marcelo Fleury avatar Victor Félix avatar João Victor avatar Cassiano Rodrigues avatar Heitor Ramon Ribeiro avatar Artur Rios avatar Lucas Souza avatar Vitor Coutinho Fernandes avatar  avatar Gabriel avatar Lucas Mella avatar Jorge avatar  avatar Gabriel Augusto avatar  avatar

Watchers

 avatar

aeria's Issues

Erro ao instanciar o `useAeria` em algum arquivo server side !

Criando uma simples função de validação utilizando os métodos do useAeria e instanciando ela dentro de algum arquivo server-side, o Next irá retornar o seguinte error:

Uma imagem do error:

image

Código do error:

./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>

Código da função que causa o error:

"use server"

import { useAeria as Aeria, isLeft } from 'aeria';

export const verifyAeriaToken = async (token: string) => {
  if (!token) {
    return false
  }
  
  const aeria = await Aeria();
    
  const isValidated = await aeria.collections.user.functions.authenticate({ revalidate: true, token: { type: 'bearer', content: token } })

  if(isLeft(isValidated)) {
    return false
  }

  return true
}

Código do arquivo server-side que ela esta sendo instanciada:

src/middleware.ts

import { NextResponse, NextRequest } from 'next/server'
import { verifyAeriaToken } from './actions/verify-aeria-token'
export async function middleware(request: NextRequest) {
  const path = request.nextUrl.pathname
  const token = request.cookies.get('@aeria-auth')?.value || ''

  const authenticated = token ? await verifyAeriaToken(token) : false

  const isPublicPath =
    path === '/applicant' ||
    path === '/applicant/sign-in' ||
    path === '/applicant/sign-up'

  const isPrivatePath =
    path === "/applicant/dashboard" ||
    path === "/applicant/profile" ||
    path === "/applicant/modules" ||
    path === "/applicant/shop" ||
    path === "/applicant/exams" ||
    path === "/applicant/create-exam" ||
    path === "/applicant/finances"

  if (!authenticated && isPrivatePath) {
    return NextResponse.redirect(new URL('/applicant/sign-in', request.nextUrl))
  }

  if (isPublicPath && authenticated) {
    return NextResponse.redirect(new URL('/applicant/dashboard', request.nextUrl))
  }

  if (!isPublicPath && !authenticated) {
    return NextResponse.redirect(new URL('/applicant/sign-in', request.nextUrl))
  }

}

export const config = {
  matcher: [
    '/applicant/:path*'
  ],
}

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.