Skip to content
Merged

Dev #32

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions apps/api/api/services/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,11 @@ class ProjectService {
}
}

async saveProjectGeneration(userId: string, projectId: string, generationData: any): Promise<void> {
async saveProjectGeneration(
userId: string,
projectId: string,
generationData: any
): Promise<void> {
if (!userId || !projectId || !generationData) {
logger.error('User ID, Project ID, and generation data are required.');
throw new Error('User ID, Project ID, and generation data are required.');
Expand Down Expand Up @@ -506,14 +510,16 @@ class ProjectService {
}

try {
// Upload ZIP file to storage
const fileName = `${projectId}-generation-${Date.now()}.zip`;
const filePath = `users/${userId}/projects/${projectId}/generations/${fileName}`;

// Use storage service to upload the file
const uploadResult = await storageService.uploadFile(zipFile.buffer, filePath, zipFile.mimetype);
// Use the new uploadProjectCodeZip method from storage service
const uploadResult = await storageService.uploadProjectCodeZip(
zipFile.buffer,
projectId,
userId
);

logger.info(`ZIP file saved successfully for project ${projectId} and user ${userId}. URL: ${uploadResult.downloadURL}`);
logger.info(
`ZIP file saved successfully for project ${projectId} and user ${userId}. URL: ${uploadResult.downloadURL}`
);
return uploadResult.downloadURL;
} catch (error: any) {
logger.error(
Expand Down Expand Up @@ -564,7 +570,9 @@ class ProjectService {
`${projectId}_github`
);

logger.info(`Project ${projectId} sent to GitHub successfully for user ${userId}. Repo: ${mockRepoUrl}`);
logger.info(
`Project ${projectId} sent to GitHub successfully for user ${userId}. Repo: ${mockRepoUrl}`
);
return mockRepoUrl;
} catch (error: any) {
logger.error(
Expand Down
54 changes: 54 additions & 0 deletions apps/api/api/services/storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,60 @@ export class StorageService {
}
}

/**
* Upload project code as ZIP file to Firebase Storage
* @param zipBuffer - The ZIP file content as Buffer
* @param projectId - Project ID for folder structure
* @param userId - User ID for folder structure (optional)
* @returns Upload result with download URL
*/
async uploadProjectCodeZip(
zipBuffer: Buffer,
projectId: string,
userId?: string
): Promise<UploadResult> {
try {
const folderPath = userId
? `users/${userId}/projects/${projectId}/code`
: `projects/${projectId}/code`;

const fileName = `project-code-${Date.now()}.zip`;

logger.info(`Uploading project code ZIP to Firebase Storage`, {
projectId,
userId,
folderPath,
fileName,
zipSize: zipBuffer.length,
});

const uploadResult = await this.uploadFile(
zipBuffer,
fileName,
folderPath,
'application/zip'
);

logger.info(`Project code ZIP uploaded successfully`, {
projectId,
userId,
fileName,
downloadURL: uploadResult.downloadURL,
zipSize: zipBuffer.length,
});

return uploadResult;
} catch (error: any) {
logger.error(`Error uploading project code ZIP`, {
projectId,
userId,
error: error.message,
stack: error.stack,
});
throw new Error(`Failed to upload project code ZIP: ${error.message}`);
}
}

/**
* Generate a unique project ID for storage purposes
* @returns A unique project ID
Expand Down
Empty file.
34 changes: 15 additions & 19 deletions apps/appgen/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![English](https://img.shields.io/badge/README-English-494cad.svg)](https://github.com/idem appgen-dev/idem appgen/blob/main/README.md) [![中文](https://img.shields.io/badge/README-中文-494cad.svg)](https://github.com/idem appgen-dev/idem appgen/blob/main/docs/README.zh.md)
[![English](https://img.shields.io/badge/README-English-494cad.svg)](https://github.com/idem appgen-dev/idem appgen/blob/main/README.md) [![中文](https://img.shields.io/badge/README-中文-494cad.svg)](https://github.com/idem appgen-dev/idem appgen/blob/main/docs/README.zh.md)

# idem appgen

Expand All @@ -7,7 +7,6 @@
![alt text](./docs/img/image-1.png)

## Video

[![youtube](https://idem appgen.ai/en/opengraph-image.png?dda1b12e6eb7c5e1)](https://www.youtube.com/watch?v=-dyf0Zb8h20)

## What Makes Idem Appgen Different?
Expand All @@ -25,15 +24,15 @@ Integrates with WeChat Mini Program Developer Tools: Allows direct preview and d
Multi-platform support: Supports Windows and Mac operating systems for client downloads, as well as web container scenarios, allowing you to choose the appropriate terminal based on usage scenarios.

| Feature | idem appgen | v0 | bolt.new |
| ------------------------------------------ | ----------- | --- | -------- |
| Code generation and preview | ✅ | ✅ | ✅ |
| Design-to-code conversion(no open) | ✅ | ✅ | ✅ |
| Open-source | ✅ | ❌ | ✅ |
| Supports WeChat Mini Program Tools preview | ✅ | ❌ | ❌ |
| Supports existing projects | ✅ | ❌ | ❌ |
| Supports Deepseek | ✅ | ❌ | ❌ |
| Supports MCP | ✅ | ❌ | ❌ |
| Supports Generate Design(no open) | ✅ | ❌ | ❌ |
| ------------------------------------------ | --- | --- | -------- |
| Code generation and preview | ✅ | ✅ | ✅ |
| Design-to-code conversion(no open) | ✅ | ✅ | ✅ |
| Open-source | ✅ | ❌ | ✅ |
| Supports WeChat Mini Program Tools preview | ✅ | ❌ | ❌ |
| Supports existing projects | ✅ | ❌ | ❌ |
| Supports Deepseek | ✅ | ❌ | ❌ |
| Supports MCP | ✅ | ❌ | ❌ |
| Supports Generate Design(no open) | ✅ | ❌ | ❌ |

## Get Started

Expand Down Expand Up @@ -63,7 +62,6 @@ pnpm install
Rename .env.example to .env and fill in the corresponding content.

Client apps/we-dev-client/.env

```shell
# SERVER_ADDRESS [MUST*] (eg: http://localhost:3000)
REACT_REACT_APP_BASE_URL=
Expand All @@ -73,7 +71,6 @@ JWT_SECRET=
```

Servers apps/we-dev-next/.env

```shell
# Third-Party Model URL [MUST*] (eg: https://api.openai.com/v1)
THIRD_API_URL=
Expand Down Expand Up @@ -102,19 +99,18 @@ Supports quick start from the root directory.
"dev:client": "cd apps/we-dev-client && pnpm dev",
```

## How to Install and Use

1. Go to https://idem appgen.ai/.
2. Select Download for Mac or Windows to download the installer.
3. Run the installer.
4. Open the Idem Appgen application.
## How to Install and Use
1. Go to https://idem appgen.ai/.
2. Select Download for Mac or Windows to download the installer.
3. Run the installer.
4. Open the Idem Appgen application.

## Contact US

send email to <a href="mailto:enzuo@wegc.cn">enzuo@wegc.cn</a>

## WeChat Group Chat

<img src="./docs/img/code.png" alt="alt text" width="200"/>

If you cannot join the WeChat group, you can add
Expand Down
6 changes: 0 additions & 6 deletions apps/appgen/apps/we-dev-client/.env.prod

This file was deleted.

Loading
Loading