Admin CLI and Next.js

I know this may be a silly question but, how do I get “moralis-admin-cli” deploy to deploy the index.js file for my Next app rather than index.html from react?

Not sure what it the error, in case that is requires an index.hml, you could add an empty index.html.

There’s not really any error. When you do “npm run dev” on a next.js app it will open a server in your browser. All the pages are navigated using index.js or page.js.

So, I uploaded an empty index.html with “Hello” and Moralis deployed it successfully. However, when I try to navigate to something like it shows the actually JS script and not the rendered HTML page how next.js app shows in local browser.

How do I get it to do that?

I’m not sure you can do that (as in to generate a static only website that can be uploaded), I didn’t use next.js before, but it looks like it serves the pages on request, like it would require a server running in javascript to generate the html pages that will get displayed.

Have you figured how to build a NextJS dapp with Moralis? Is it possible?

you mean to deploy a next js app to moralis static hosting or something else?

I mean build an analytics dapp using NextJS and use Moralis login and Moralis react hooks to retrieve data from chain. Also call Moralis cloud functions from the NextJS dapp and access dashboard data. In short create a full fledged dapp with Moralis, but instead of react use nextjs. possible?

it should work without problems

1 Like

I found a very useful article on how to setup Moralis on a NextJS app. Using Moralis with Next.js - LogRocket Blog

1 Like