|
1 | | -# NeoApps.AI-CodeGenerator |
2 | | -Code generator to generated drag and drop react application and .net core API with mysql database. |
| 1 | +# NeoApps.AI- Code Generator |
| 2 | +# Project Setup and App Generation Guide |
| 3 | + |
| 4 | +## Prerequisites |
| 5 | + |
| 6 | +Before running the project, ensure you have the following installed: |
| 7 | + |
| 8 | +1. **Visual Studio** or **Visual Studio Code** |
| 9 | +2. **Docker** |
| 10 | +3. **XAMPP** |
| 11 | +4. **Redis, RabbitMQ, and MinIO (S3)** |
| 12 | + |
| 13 | +### Docker Setup for Redis, RabbitMQ, and MinIO (S3) |
| 14 | + |
| 15 | +Use the following Docker commands to set up Redis, RabbitMQ, and MinIO (S3): |
| 16 | + |
| 17 | +- **MinIO** |
| 18 | + ```bash |
| 19 | + docker run -d --name minio -p 9000:9000 --env-file .env \ |
| 20 | + -e MINIO_ROOT_USER=${MINIO_ROOT_USER} \ |
| 21 | + -e MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD} \ |
| 22 | + -v minio-data:/data minio/minio:latest server /data |
| 23 | + ``` |
| 24 | + |
| 25 | +- **Redis** |
| 26 | + ```bash |
| 27 | + docker run -d --name redis -p 6379:6379 --env-file .env \ |
| 28 | + -e REDIS_PASSWORD=${REDIS_PASSWORD} \ |
| 29 | + -v redis-data:/data redis:latest \ |
| 30 | + redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes |
| 31 | + ``` |
| 32 | + |
| 33 | +- **RabbitMQ** |
| 34 | + ```bash |
| 35 | + docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 --env-file .env \ |
| 36 | + -v rabbitmq-data:/var/lib/rabbitmq rabbitmq:management |
| 37 | + ``` |
| 38 | + |
| 39 | +### Configuration |
| 40 | + |
| 41 | +Add the following configurations to `appsettings.json` for MinIO (S3), Redis, and RabbitMQ: |
| 42 | + |
| 43 | +```json |
| 44 | +{ |
| 45 | + "MinIO": { |
| 46 | + "AccessKey": "${MINIO_ROOT_USER}", |
| 47 | + "SecretKey": "${MINIO_ROOT_PASSWORD}", |
| 48 | + "Endpoint": "http://localhost:9000" |
| 49 | + }, |
| 50 | + "Redis": { |
| 51 | + "Connection": "localhost:6379,password=${REDIS_PASSWORD}" |
| 52 | + }, |
| 53 | + "RabbitMQ": { |
| 54 | + "Connection": "amqp://${REDIS_USER}:${REDIS_PASSWORD}@localhost:5672/" |
| 55 | + } |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +## Steps to Generate the Project |
| 60 | + |
| 61 | +### 1. Database Schema Design |
| 62 | + |
| 63 | +Ensure your database schema follows the guidelines provided by NeoApps.AI. You can find the guidelines [here](https://docs.neoapps.ai/User%20Guide/Project%20Creation/databaseguidelines). |
| 64 | + |
| 65 | +### 2. Save the Script |
| 66 | + |
| 67 | +Save your database script in `.sql` format. Example scripts are available on the guidelines page. |
| 68 | + |
| 69 | +### 3. Upload Script to XAMPP |
| 70 | + |
| 71 | +Upload your script to XAMPP by placing it in the `htdocs` directory. This will allow it to be accessible via the XAMPP server. |
| 72 | + |
| 73 | +### 4. Setup MySQL Database |
| 74 | + |
| 75 | +Set up your MySQL database with the following parameters: |
| 76 | + |
| 77 | +- **Database Name**: Your chosen database name |
| 78 | +- **Username**: `root` (or your configured username) |
| 79 | +- **Password**: (leave empty if not set) |
| 80 | +- **Port**: `3306` |
| 81 | + |
| 82 | +### 5. Update Launch Settings |
| 83 | + |
| 84 | +Update `launchSettings.json` with the following parameters for backend generation: |
| 85 | + |
| 86 | +```json |
| 87 | +{ |
| 88 | + "project_id": 1, |
| 89 | + "server": "localhost", |
| 90 | + "uid": 1, |
| 91 | + "username": "root", |
| 92 | + "password": "", |
| 93 | + "databaseName": "splitthebill", |
| 94 | + "script": "http://localhost/split_app_script.sql", |
| 95 | + "statusOfGeneration": null, |
| 96 | + "projectName": "SplitTheBill", |
| 97 | + "DBexists": "No", |
| 98 | + "port": 3306, |
| 99 | + "rabbitMQConn": "amqp://user:password@localhost:5672/", |
| 100 | + "redisConn": "localhost:6379,password=REDIS_PASSWORD=yourredispassword", |
| 101 | + "apiflowurl": "", |
| 102 | + "fronttemplateurl": "", |
| 103 | + "Technology_Frontend": "", |
| 104 | + "Backend_technology": "dotnet", |
| 105 | + "buttonClicked": "generate", |
| 106 | + "projectType": "", |
| 107 | + "swgurl": "", |
| 108 | + "noderedurl": null |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +### 6. Generate Backend |
| 113 | + |
| 114 | +Once you generate the project, the generated code will be available in the `bin/debug` folder. |
| 115 | + |
| 116 | +### 7. Save the Generated Code |
| 117 | + |
| 118 | +Copy the generated code folder and place it into your repository or preferred directory. |
| 119 | + |
| 120 | +### 8. Run the Project |
| 121 | + |
| 122 | +Open the project in Visual Studio or Visual Studio Code and run it. If you encounter any errors, check your database schema for issues. |
| 123 | + |
| 124 | +### 9. Generate Frontend |
| 125 | + |
| 126 | +Generate the frontend code and ensure both the frontend and backend projects are configured correctly. Copy them into your repository or preferred directory. |
| 127 | + |
| 128 | +### 10. Regenerate Project |
| 129 | + |
| 130 | +If you need to regenerate the project or make changes to the database schema, drop the existing database tables and rerun the project. |
| 131 | + |
| 132 | +### 11. Run the .NET API |
| 133 | + |
| 134 | +After copying the projects, run the .NET API as needed. |
| 135 | + |
| 136 | +--- |
| 137 | + |
| 138 | +Follow these steps, and you should be able to run the project and generate the apps without any issues. |
0 commit comments