Getting Started

Welcome to the documentation. This guide will help you get started with MatureStack.

One important thing to note is, as MatureStack encourages to split frontend and backend you will be working on two repositories.

Prerequisites

  • Node.js 20+ installed
  • Git installed
  • MongoDB installed and running

Installation Steps

1. Clone the Repository

git clone https://github.com/maturestack/maturestack-frontend.git
git clone https://github.com/maturestack/maturestack-backend.git

2. Environment Setup

Create a .env file in the root directory of the maturestack-frontend:

NEXT_PUBLIC_API_URL=http://localhost:3000/api/

Create a .env file in the root directory of the maturestack-backend:

PORT=3000
URL=http://localhost
JWT_SECRET=secret
DATABASE_URL=mongodb://${{USERNAME}}:${{PASSWORD}}@${{HOSTNAME}}:27017
DATABASE_NAME=maturestack

You can use the following command to generate a JWT_SECRET for yourself

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

3. Install dependencies

You can use the any of your favorite package manager though I prefer using yarn

cd maturestack-frontend
yarn
cd ..
cd maturestack-backend
yarn

4. Start the application

You need to have two terminals to get everything going as we have two repos

Frontend:

cd maturestack-frontend
yarn dev

Backend:

cd maturestack-backend
yarn start:dev

Make sure that you have the correct url in the above envs matching on which port the backend is running

Project Structure

Frontend

maturestack-frontend/
├── public            # Static assets
├── src               # Main directory
    ├── app           # Next.js app directory
    ├── components    # Reusable React components
    ├── hooks         # Reusable React hooks
    ├── lib           # Reusable helper functions
    ├── providers     # Global React providers
    └── services      # Reusable services like API Client

Backend

maturestack-backend/
├── src
    ├── app.module.ts # NestJS main app module
    ├── auth          # Module handling sign up and login 
    ├── config        # Configuration mapping from envs
    ├── dectorators   # Reusable decorators
    ├── email         # Module to send emails
    ├── factories     # Reusable factories for decorators
    ├── main.ts       # Setup of global headers
    ├── pipelines     # Reusable pipelines e.g. Validation
    ├── tenant        # Multi tenant module (if required)
    └── users         # Module for all user related interactions
  

Next Steps

  • Set up authentication with your preferred provider
  • Customize the theme and styling
  • Add your first feature using the built-in components
  • Deploy your application

Troubleshooting

If you encounter any issues:

  1. Ensure all prerequisites are properly installed
  2. Verify your environment variables are correctly set
  3. Check the database connection is active
  4. Clear your .next cache:rm -rf .next

For more detailed information, please refer to our other documentation sections or open an issue on GitHub.

MatureStack LogoBuilt with MatureStack