Skip to content

Latest commit

 

History

History
94 lines (68 loc) · 2.72 KB

README.MD

File metadata and controls

94 lines (68 loc) · 2.72 KB

Node Server Boilerplate

Welcome to the Node Server Boilerplate! This boilerplate provides a simple yet scalable server to build, share, and manage content. Below is an overview of the project structure and its key components.

Project Structure

- src
  - main.ts
  - utils
    - constants.ts
    - security.ts
    - converter.ts
  - config
    - config.ts
  - events
    - schedule.ts
  - data
    - database.ts
    - persistence.ts
    - state.managment.ts
  - services
  - connections
    - server.ts
    - sockets.ts
      - server.items.ts
      - sockets.player.ts
      - sockets.chat.ts
  - models
    - player.models.ts
    - database.models.ts
    - chat.models.ts
    - config.models.ts
- .gitignore
- package-lock.json
- package.json
- persistence.json
- tsconfig.json
- tsconfig.paths.json

Key Components

1. src/main.ts

This is the main entry point for the server. It orchestrates the server setup and initialization of various components.

2. src/utils

This folder contains utility modules such as constants.ts, security.ts, and converter.ts.

3. src/config

Configuration settings for the server are defined in config.ts.

4. src/events

This folder includes event-related functionalities. Currently, it features schedule.ts for scheduling tasks.

5. src/data

The data directory encompasses modules for handling data-related tasks, such as database interaction (database.ts), persistence (persistence.ts), and state management (state.managment.ts).

6. src/connections

This folder manages server connections and includes server.ts for general server setup, and sockets.ts with sub-modules like server.items.ts, sockets.player.ts, and sockets.chat.ts for socket communication.

7. src/models

Model definitions for various components are stored here, including player.models.ts, database.models.ts, chat.models.ts, and config.models.ts.

How to Run

  1. Install dependencies: npm install
  2. Build the project: npm run build
  3. Start the server: npm start

For example usage with a private key: npm run start-example -- --k <private-key>

Technologies Used

  • Express for server setup
  • Socket.IO for real-time communication
  • Firebase for auth and database interaction
  • Node Schedule for scheduling tasks
  • And other essential packages listed in package.json

Development Dependencies

  • TypeScript for code transpilation
  • Various @types packages for TypeScript type definitions
  • Other development dependencies specified in devDependencies in package.json

Feel free to explore, customize, and expand upon this boilerplate for your specific project needs. If you have any questions or need assistance, don't hesitate to reach out!