@opengis/fcore
v0.0.1-beta.12
Published
Reusable backend foundation for OpenGIS Node.js applications
Maintainers
Keywords
Readme
@opengis/fcore
Reusable backend foundation for OpenGIS Node.js applications: config, typed application context, PostgreSQL, Redis, S3 file storage, audit, trusted Resource CRUD, Core modules, Fastify integration and SQL migration runner.
Install
npm install @opengis/fcoreBootstrap
import { createFCore } from '@opengis/fcore';
import resources from './resources/index.js';
export const ctx = await createFCore({ resources });import Fastify from 'fastify';
import fcoreFastify from '@opengis/fcore/fastify';
import { ctx } from './app.js';
const app = Fastify();
await app.register(fcoreFastify, { ctx });
await app.listen({ port: ctx.config.port });Resource
All dynamic table/column identifiers come from registered ResourceContract metadata. Values are SQL parameters.
Migrations
Project SQL files stay in ./migrations. Build the package/application, then run fcore-migrate or import runMigrations().
Module service convention
Module services are plain async functions with the canonical service(params, ctx) signature. ctx is passed explicitly from fastify.ts to each module route.ts; there is no service.ts or createService() factory.
Structure
@opengis/fcore
├── src/
│ ├── plugins/
│ │ ├── logger/
│ │ ├── redis/
│ │ ├── pg/
│ │ ├── file/
│ │ ├── audit/
│ │ └── resource/
│ ├── modules/
│ │ ├── auth/
│ │ ├── access/
│ │ ├── resource/
│ │ ├── file/
│ │ ├── template/
│ │ └── system/
│ ├── migrations/
│ ├── config.ts # loadConfig
│ ├── context.ts # createContext, set, get
│ ├── errors.ts # standard Errors
│ ├── fastify.ts # fastify Plugins
│ ├── fcore.ts # createFcore
│ └── index.ts # export type, methods, etc
├── test/
├── engineering/
├── package.json
└── tsconfig.json