/badman-m3

Primary LanguageTypeScript

Project README

Project Overview

This project is a Angular (With SSR) + Nestjs monorepo using Nx. It is a full-stack application that demonstrates how to structure and manage frontend and backend applications within a single Nx workspace.

TODO

Feel free to contribute to this project by creating a pull request.

  • Check on how to build for bun runtime
  • Pre rendering routes doesn't spin up the server, so the HTTP calls are not working (Made a build workaround npm script)

Other variants of this project

Directory Structure

The directory structure of this Nx monorepo is organized as follows:

Apps

  • apps/app: This is the main Angular application with SSR enabled.
  • apps/api: This directory is used for running the backend server during development.

Libsf

  • libs/backend/_shared: This directory contains the entry point for the backend services. It includes necessary configurations and files to initialize and run the backend application.
  • libs/frontend/root: This directory contains the entry point for the frontend services. It includes necessary configurations and files to initialize and run the frontend application.

Getting Started

s

Prerequisites

Ensure you have the following installed on your machine:

  • Node.js (Node 20 is recommended, 22 doens't seem to build the SSG)
  • Nx CLI

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd <repository-name>
  2. Install the dependencies:

    npm install

Running the Applications

To run the application:

npm start

This will start the development server and the application will be available at http://localhost:4200.

Building the Applications

Build Frontend

To build the Angular application for production:

npm run build

To run the Application:

node dist/apps/app/server/server.mjs

Testing

Running Unit Tests

To run unit tests:

nx run-many -t test

Running End-to-End Tests

To run end-to-end tests:

nx e2e app-e2e

For blogs and documentation sites

You can enable SSG then because there is no login or dynamic content, you can build the site and serve it statically. To do this, follow the steps below:

  1. Add prerender to apps/app/project.json
"prerender": {
   "routesFile": "routes.txt"
},
  1. switch the build script to with the one from build:ssg in package.json
  2. done