e2b-dev / fragments

Open-source Next.js template for building apps that are fully generated by AI. By E2B.
https://fragments.e2b.dev
Apache License 2.0
3.48k stars 455 forks source link

Which code started the Node.js Server #6

Closed binhe22 closed 3 months ago

binhe22 commented 3 months ago

Hi,

I have a question. I read the Dockerfile and the source code,

after we write the code to "/home/user/app/page.tsx",I didn't find the code to start the node.js server in the sandbox?

Did I missed something? Where is the code for starting the server?

Thanks

mlejva commented 3 months ago

Hi,

I have a question. I read the Dockerfile and the source code,

after we write the code to "/home/user/app/page.tsx",I didn't find the code to start the node.js server in the sandbox?

Did I missed something? Where is the code for starting the server?

Thanks

Hey, the code that starts the Nextjs server is done via the start command. It's currently not a great DX as it's a bit hidden for users - it's in the e2b.toml file.

You specify the start command when you're building a custom template - https://e2b.dev/docs/cli/commands#template-build

In this AI artifacts example it's this

e2b template build -c "cd /home/user && npx next"

Just note that the default free sandbox might not have enough RAM. We just had another user doing this and the sandbox kept crashing because of OOM and they needed to create a sandbox with more RAM - https://e2b.dev/docs/sandbox/compute. I think we should consider allowing users on the free tier to have at least 1GB of RAM.

binhe22 commented 3 months ago

got it, thanks a lot

it works for me with the free tier (But i will pay for it haha)