Welcome to suff – a powerful and flexible framework designed to streamline the creation of REST APIs with Node.js and Express. Whether you’re a beginner looking for a quick setup or an experienced developer seeking a customizable solution, suff simplifies the process of building and configuring your APIs.
suff automates the setup of common backend components, so you can focus on developing your application instead of spending time on boilerplate code and configuration. With suff, you can choose your preferred language (TypeScript or JavaScript) and database (Mongoose or Prisma) during installation. The framework also provides a well-structured folder layout and integrates useful tools like dotenv for environment management and logging capabilities.
- Choose Your Language: Options for TypeScript or JavaScript.
- Flexible Database Integration: Supports Mongoose for MongoDB or Prisma for various databases.
- Automatic Configuration: Sets up Express, MongoDB, and other dependencies.
- Structured Project Layout: Creates folders for routes, controllers, models, utilities, and configuration.
- Open Source: Contribute and collaborate with the community.
When you set up your project with suff, the following folder structure will be created:
my-api-project/
├── config/ # Configuration files (e.g., environment settings)
├── models/ # Database models
├── routes/ # API routes
├── utils/ # Utility functions and helpers
├── .env # Environment variables
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration (if TypeScript is chosen)
├── index.js # Entry point for the application
└── README.md # Project documentation
To get started with suff, follow these steps:
-
Install the Framework:
Use
npxto run the installation command:npx create-suff-server
You'll be prompted to select your preferred language and database.
-
Navigate to Your Project Directory:
cd my-api-project -
Start the Development Server:
Run the development server with:
npm run dev
-
Configure Your Environment:
Edit the
.envfile to set up your environment variables and database connection settings. Make sure to specify theNODE_ENVvariable:NODE_ENV=development
-
Develop Your API:
- Define your routes in the
routesfolder. - Implement your business logic in the
controllersfolder. - Define your data models in the
modelsfolder. - Use utilities from the
utilsfolder as needed.
- Define your routes in the
-
Environment Configuration:
suffuses environment variables specified in the.envfile. TheNODE_ENVvariable determines if the application is running in development mode or production mode, affecting the setup of routes and other configurations. -
Commands:
The framework provides several commands to interact with your project:
create-suff-server: Initializes a newsuffproject.suff: CLI tool with various commands:dev: Starts the development server withnodemonfor auto-reloading.build: Builds the project for production.start: Starts the project in production mode.test: Runs tests for your project.
We welcome contributions from the community! If you’d like to help improve suff, please follow these guidelines:
- Fork the Repository: Create your own copy of the repository.
- Clone Your Fork: Clone your fork to your local machine.
- Create a Branch: Create a new branch for your changes.
- Commit Your Changes: Commit your changes with a clear message.
- Push to GitHub: Push your changes to your fork.
- Open a Pull Request: Submit a pull request with a description of your changes.
suff is open source and available under the MIT License.
For any questions or feedback, please contact us at [mail@prenext.com].