[GH-ISSUE #134] Saving the output to JSON to store in DB #274

Closed
opened 2026-03-15 02:01:10 +03:00 by kerem · 6 comments
Owner

Originally created by @HeapReaper on GitHub (Feb 25, 2025).
Original GitHub issue: https://github.com/arikchakma/maily.to/issues/134

Hi.
First of all, damn, this is such an nice project!
I'm integrating it into my services. Now i wanna make an custom save option.
What is the best way of doing this?
Hope you can give me some information about it! :)

Originally created by @HeapReaper on GitHub (Feb 25, 2025). Original GitHub issue: https://github.com/arikchakma/maily.to/issues/134 Hi. First of all, damn, this is such an nice project! I'm integrating it into my services. Now i wanna make an custom save option. What is the best way of doing this? Hope you can give me some information about it! :)
kerem closed this issue 2026-03-15 02:01:15 +03:00
Author
Owner

@arikchakma commented on GitHub (Feb 25, 2025):

You can use something like this, you don't need to keep the JSON in a separate store/state. While saving, you can use editor.getJSON() and save it in your backend.

<!-- gh-comment-id:2683098029 --> @arikchakma commented on GitHub (Feb 25, 2025): You can use something like [this](https://github.com/arikchakma/maily.to/blob/28b29f65015100b044d3d0dc28be87467bb67674/apps/web/components/editor-preview.tsx#L201-L204), you don't need to keep the JSON in a separate store/state. While saving, you can use `editor.getJSON()` and save it in your backend.
Author
Owner

@HeapReaper commented on GitHub (Feb 26, 2025):

Hi, thanks for you're extremely fast reaction!
I will use that :)
Small side node, i wanna deploy it to Vervel. Do you know what i need to do? I did add the env variables to the application.
Image

Update, now trying Dockerfile:

FROM node:20-alpine

WORKDIR /app

COPY package.json pnpm-lock.yaml turbo.json ./

RUN npm install -g pnpm

RUN pnpm install --frozen-lockfile

COPY . .

RUN pnpm run build

WORKDIR /app/apps/web

ENV NODE_ENV production

EXPOSE 3000

HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl -f http://localhost:3000/ || exit 1

CMD ["pnpm", "start"]

Tho getting command finished with error: command (/app/packages/render) /root/.local/share/pnpm/.tools/pnpm/9.15.4/bin/pnpm run build exited (1) with some CSS error.

<!-- gh-comment-id:2684228059 --> @HeapReaper commented on GitHub (Feb 26, 2025): Hi, thanks for you're extremely fast reaction! I will use that :) Small side node, i wanna deploy it to Vervel. Do you know what i need to do? I did add the env variables to the application. ![Image](https://github.com/user-attachments/assets/f16b20a9-10ce-4948-8e5d-6d6fdf618607) Update, now trying Dockerfile: ``` FROM node:20-alpine WORKDIR /app COPY package.json pnpm-lock.yaml turbo.json ./ RUN npm install -g pnpm RUN pnpm install --frozen-lockfile COPY . . RUN pnpm run build WORKDIR /app/apps/web ENV NODE_ENV production EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD curl -f http://localhost:3000/ || exit 1 CMD ["pnpm", "start"] ``` Tho getting `command finished with error: command (/app/packages/render) /root/.local/share/pnpm/.tools/pnpm/9.15.4/bin/pnpm run build exited (1)` with some CSS error.
Author
Owner

@HeapReaper commented on GitHub (Feb 26, 2025):

Image

I got it working:

FROM node:18-alpine

WORKDIR /app

COPY package.json pnpm-lock.yaml ./

# Install pnpm and dependencies
RUN npm install -g pnpm && pnpm install --frozen-lockfile

# Install additional packages
RUN apk add --no-cache curl wget

COPY . .

# Ensure dependencies are installed in all packages
WORKDIR /app/packages/render
RUN pnpm install && pnpm add @tiptap/core

WORKDIR /app/apps/web
RUN pnpm install

# Expose the correct port
EXPOSE 3000

# Set environment variable to bind to 0.0.0.0
ENV HOST=0.0.0.0
ENV PORT=3000

# Start the application
CMD ["pnpm", "dev"]

But it shows Module not found: Can't resolve '@maily-to/core'

<!-- gh-comment-id:2685700844 --> @HeapReaper commented on GitHub (Feb 26, 2025): ![Image](https://github.com/user-attachments/assets/594b00ce-7f3d-4968-8f53-24871661ff15) I got it working: ``` FROM node:18-alpine WORKDIR /app COPY package.json pnpm-lock.yaml ./ # Install pnpm and dependencies RUN npm install -g pnpm && pnpm install --frozen-lockfile # Install additional packages RUN apk add --no-cache curl wget COPY . . # Ensure dependencies are installed in all packages WORKDIR /app/packages/render RUN pnpm install && pnpm add @tiptap/core WORKDIR /app/apps/web RUN pnpm install # Expose the correct port EXPOSE 3000 # Set environment variable to bind to 0.0.0.0 ENV HOST=0.0.0.0 ENV PORT=3000 # Start the application CMD ["pnpm", "dev"] ``` But it shows `Module not found: Can't resolve '@maily-to/core'`
Author
Owner

@arikchakma commented on GitHub (Feb 26, 2025):

I also get this error sometimes while running it locally, but few mins it works fine. I think it's an issue with the previous version of Next, but I am not willing to upgrade now as something new is coming soon.

<!-- gh-comment-id:2686126029 --> @arikchakma commented on GitHub (Feb 26, 2025): I also get this error sometimes while running it locally, but few mins it works fine. I think it's an issue with the previous version of Next, but I am not willing to upgrade now as something new is coming soon.
Author
Owner

@HeapReaper commented on GitHub (Feb 27, 2025):

Hmm check.
@arikchakma would you mind sharing the commands to run a production build for this project?

<!-- gh-comment-id:2688665670 --> @HeapReaper commented on GitHub (Feb 27, 2025): Hmm check. @arikchakma would you mind sharing the commands to run a production build for this project?
Author
Owner

@arikchakma commented on GitHub (Feb 27, 2025):

I am also hosting it in Vercel, I run this command to do the production build cd ../.. && turbo run build --filter=web.

<!-- gh-comment-id:2688853571 --> @arikchakma commented on GitHub (Feb 27, 2025): I am also hosting it in Vercel, I run this command to do the production build `cd ../.. && turbo run build --filter=web`.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/maily.to#274
No description provided.