{"id":48577849,"url":"https://github.com/amanbig/backtool","last_synced_at":"2026-04-08T16:03:42.127Z","repository":{"id":291379525,"uuid":"977447013","full_name":"Amanbig/backTool","owner":"Amanbig","description":"A CLI tool to generate backend structures for Node.js applications with support for multiple databases and a visually appealing user interface.","archived":false,"fork":false,"pushed_at":"2025-12-28T11:40:13.000Z","size":162,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-30T02:44:32.542Z","etag":null,"topics":["bycryptjs","cors","express","hacktoberfest","javascript","mongodb","mysql","npm","npm-package","postgresql","sqlite","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/backtool","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Amanbig.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-04T08:26:38.000Z","updated_at":"2025-12-28T11:39:52.000Z","dependencies_parsed_at":"2025-08-05T12:32:08.316Z","dependency_job_id":null,"html_url":"https://github.com/Amanbig/backTool","commit_stats":null,"previous_names":["amanbig/backtool"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Amanbig/backTool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amanbig%2FbackTool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amanbig%2FbackTool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amanbig%2FbackTool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amanbig%2FbackTool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amanbig","download_url":"https://codeload.github.com/Amanbig/backTool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amanbig%2FbackTool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31562697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bycryptjs","cors","express","hacktoberfest","javascript","mongodb","mysql","npm","npm-package","postgresql","sqlite","typescript"],"created_at":"2026-04-08T16:03:41.512Z","updated_at":"2026-04-08T16:03:42.122Z","avatar_url":"https://github.com/Amanbig.png","language":"JavaScript","funding_links":["https://buymeacoffee.com/amanpreet"],"categories":[],"sub_categories":[],"readme":"![backtool](https://socialify.git.ci/Amanbig/backTool/image?font=Source+Code+Pro\u0026language=1\u0026name=1\u0026owner=1\u0026pattern=Brick+Wall\u0026theme=Dark)\n\n# BackTool\n\nA CLI tool to generate backend structures for Node.js applications with support for multiple databases and a visually appealing user interface.\n\n## Overview\n\nBackTool simplifies the process of setting up a Node.js backend by generating a complete project structure, including a server entry point, models, database configuration, controllers, routes, middleware, and a customized `package.json`. It supports MongoDB, PostgreSQL, MySQL, and SQLite, allowing developers to quickly scaffold a backend tailored to their preferred database.\n\n## Features\n\n- **Docker Support**: Generates `Dockerfile` and `docker-compose.yml` tailored to the selected database.\n- **Linting \u0026 Formatting**: Optional setup for `ESLint` and `Prettier` for code quality.\n- **Security \u0026 Logging**: Includes `helmet` for security headers and `morgan` for request logging by default.\n- **Environment Configuration**: Includes `.env.example` template that gets copied to `.env` for easy environment setup.\n- **Database Support**: Generates configurations and models for MongoDB, PostgreSQL, MySQL, and SQLite.\n- **Improved Model Interfaces**: Standardized models for consistent usage across all databases.\n- **File Overwrite Protection**: Prompts users before overwriting existing files (e.g., `server.js`, `package.json`, model files).\n- **Extensible**: Easily add new databases or structure components by updating the template folder.\n\n## Installation\n\nInstall BackTool globally to use it from any directory:\n\n```bash\nnpm install -g backtool\n```\n\nAlternatively, clone the repository and link it locally:\n\n```bash\ngit clone https://github.com/Amanbig/backtool.git\ncd backtool\nnpm install\nnpm link\n```\n\n## Usage\n\n### Interactive Mode\nRun BackTool without arguments to use interactive prompts:\n\n```bash\nbacktool\n```\n\nor directly using:\n\n```bash\nnpx backtool@latest\n```\n\nThis will display an ASCII banner and prompt for:\n- Project name (e.g., `my-app`)\n- Database choice (MongoDB, MySQL, PostgreSQL, or SQLite)\n\n### Non-Interactive Mode\nSpecify options directly to skip prompts:\n\n```bash\nbacktool --project my-app --database MongoDB\n```\n\n### Options\n- `-p, --project \u003cname\u003e`: Specify the project name (default: `my-app`).\n- `-d, --database \u003ctype\u003e`: Specify the database (MongoDB, MySQL, PostgreSQL, SQLite).\n- `-l, --language \u003ctype\u003e`: Specify the language (JavaScript, TypeScript).\n- `-f, --force`: Force overwrite of existing files without prompting.\n- `-u, --uri \u003curi\u003e`: Specify database connection URI.\n- `--docker`: Generate Dockerfile and docker-compose.yml.\n- `--linter`: Configure ESLint and Prettier.\n- `-v, --version`: Display the version number.\n- `-h, --help`: Show help information.\n\n## Generated Structure\n\nRunning BackTool creates one of the following directory structures based on the chosen language:\n\n### JavaScript Structure\n```\nmy-app/\n├── server.js\n├── package.json\n├── .env\n├── .gitignore\n├── config/\n│   └── database.js\n├── models/\n│   └── user.\u003cdatabase\u003e.js\n├── controllers/\n│   └── authController.js\n├── routes/\n│   └── auth.js\n├── middleware/\n│   └── auth.js\n├── node_modules/\n└── .git/\n```\n\n### TypeScript Structure\n```\nmy-app/\n├── server.ts\n├── package.json\n├── tsconfig.json\n├── .env\n├── .gitignore\n├── src/\n│   ├── config/\n│   │   └── database.ts\n│   ├── models/\n│   │   └── user.\u003cdatabase\u003e.ts\n│   ├── controllers/\n│   │   └── authController.ts\n│   ├── routes/\n│   │   └── auth.ts\n│   ├── middleware/\n│   │   └── auth.ts\n│   └── types/\n│       └── express.d.ts\n├── dist/           # Compiled JavaScript\n├── node_modules/\n└── .git/\n```\n\n- **server.[js|ts]**: Entry point for the Node.js application, setting up the Express server and routes.\n- **package.json**: Includes project configuration, scripts, and dependencies. For TypeScript projects, includes additional scripts for building and type checking.\n- **tsconfig.json**: (TypeScript only) TypeScript compiler configuration.\n- **config/database.[js|ts]**: Database connection and table initialization.\n- **models/**: Database models with database-specific implementations.\n- **controllers/**: Request handling logic including authentication.\n- **routes/**: API route definitions.\n- **middleware/**: Custom middleware (e.g., authentication).\n- **types/**: (TypeScript only) Type definitions and declarations.\n- **dist/**: (TypeScript only) Compiled JavaScript output.\n\nThe `users` table/model includes fields: `id`, `username`, `email`, `password`, and `created_at`.\n\n## Running the Application\n\nAfter generating the project, navigate to the project directory and run:\n\n```bash\n# For JavaScript projects\nnpm start\n\n# For TypeScript projects\nnpm start        # Runs with ts-node\nnpm run build    # Compiles TypeScript to JavaScript\nnpm run start:prod  # Runs the compiled JavaScript\n```\n\nFor development with auto-restart on file changes:\n\n```bash\nnpm run dev     # Works for both JavaScript and TypeScript\n```\n\n## Supported Databases\n\n- **MongoDB**: Uses `mongoose` for schema-based modeling.\n- **PostgreSQL**: Uses `pg` with a connection pool and SQL queries.\n- **MySQL**: Uses `mysql2` with a promise-based connection pool.\n- **SQLite**: Uses `sqlite3` and `sqlite` for lightweight, file-based storage.\n\n## Dependencies\n\nBackTool installs the following dependencies in the generated project:\n\n### Common Dependencies\n- **Core Dependencies**: `express`, `dotenv`, `cors`, `jsonwebtoken`, `helmet`, `morgan`\n- **Database-specific Dependencies**:\n  - MongoDB: `mongoose`, `bcryptjs`\n  - PostgreSQL: `pg`, `bcryptjs`\n  - MySQL: `mysql2`, `bcryptjs`\n  - SQLite: `sqlite3`, `bcryptjs`\n\n### Development Dependencies\n- **Common**: `nodemon`\n- **TypeScript-specific** (when TypeScript is selected):\n  - `typescript`\n  - `ts-node`\n  - `@types/node`\n  - `@types/express`\n  - `@types/cors`\n  - `@types/jsonwebtoken`\n  - `@types/bcryptjs`\n  - Database-specific types (e.g., `@types/mongoose`, `@types/pg`)\n\n## Development\n\nTo contribute or modify BackTool:\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/Amanbig/backtool.git\n   ```\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n3. Update the `backtool_folder` directory with custom templates (e.g., `server.js`, models).\n4. Test locally:\n   ```bash\n   npm link\n   backtool --project test-app --database SQLite\n   ```\n\n[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-%E2%98%95%EF%B8%8F-orange?style=for-the-badge)](https://buymeacoffee.com/amanpreet)\n\n\n## License\n\nMIT License\n\n## Contact\n\nFor issues or feature requests, open a ticket on the [GitHub repository](https://github.com/Amanbig/backtool).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famanbig%2Fbacktool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famanbig%2Fbacktool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famanbig%2Fbacktool/lists"}