Skip to content

skyne/open-filament-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenFilamentApi

✨ Your new, shiny Nx workspace is ready ✨.

Learn more about this workspace setup and its capabilities or run npx nx graph to visually explore what was created. Now, let's get you up to speed!

🚀 Quick Start

Prerequisites

  • Node.js (v18+)
  • Docker and Docker Compose
  • npm

Start the Full Stack Application

# Start everything (MongoDB + API + Frontend)
npm start

# Or step by step:
npm run docker:up     # Start MongoDB container
npm run dev          # Start both API and Frontend services

This will start:

  • MongoDB: Running on localhost:27017 (with authentication)
  • API Service: Running on localhost:3000
  • Frontend: Running on localhost:4200

Individual Services

# Start just the API service
npx nx serve api-service

# Start just the frontend
npx nx serve frontend-web

# Build both projects
npm run build

Docker Commands

# Start MongoDB container
npm run docker:up

# Stop and remove containers
npm run docker:down

# View MongoDB logs
npm run docker:logs

# Reset MongoDB data (removes all data!)
npm run docker:reset

Environment Configuration

Copy .env.example to .env and configure the following variables:

CORS Configuration

The API supports configurable CORS origins for cross-origin requests:

  • CORS_ORIGINS: Comma-separated list of allowed origins (default: http://localhost:4200)
  • Example: CORS_ORIGINS=http://localhost:4200,http://localhost:3000,https://yourdomain.com

MongoDB Configuration

  • MONGO_URI: Full MongoDB connection string with authentication
  • MONGO_HOST: MongoDB host (default: localhost)
  • MONGO_PORT: MongoDB port (default: 27017)
  • MONGO_DB: Database name (default: filament_db)
  • MONGO_USER: Database user (default: filament_user)
  • MONGO_PASSWORD: Database password (default: filament_password)

Other Configuration

  • NODE_ENV: Environment (development/production)
  • PORT: Server port (default: 3000)

Architecture

The project consists of:

  • API Service (apps/api-service): Fastify-based REST API with MongoDB
  • Frontend Web (apps/frontend-web): Next.js application consuming the API
  • Database: MongoDB running in Docker with authentication

The frontend depends on the API service, ensuring proper build and deployment order.

Run tasks

To run the dev server for your app, use:

npx nx serve api-service

To create a production bundle:

npx nx build api-service

To see all available targets to run for a project, run:

npx nx show project api-service

These targets are either inferred automatically or defined in the project.json or package.json files.

More about running tasks in the docs »

Add new projects

While you could add new projects to your workspace manually, you might want to leverage Nx plugins and their code generation feature.

Use the plugin's generator to create new projects.

To generate a new application, use:

npx nx g @nx/node:app demo

To generate a new library, use:

npx nx g @nx/node:lib mylib

You can use npx nx list to get a list of installed plugins. Then, run npx nx list <plugin-name> to learn about more specific capabilities of a particular plugin. Alternatively, install Nx Console to browse plugins and generators in your IDE.

Learn more about Nx plugins » | Browse the plugin registry »

Set up CI!

Step 1

To connect to Nx Cloud, run the following command:

npx nx connect

Connecting to Nx Cloud ensures a fast and scalable CI pipeline. It includes features such as:

Step 2

Use the following command to configure a CI workflow for your workspace:

npx nx g ci-workflow

Learn more about Nx on CI

Install Nx Console

Nx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.

Install Nx Console »

Useful links

Learn more:

And join the Nx community:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors