Next.js Discord

Discord Forum

Tools Dashboard with Tools architecture

Answered
Large garden bumble bee posted this in #help-forum
Open in Discord
Large garden bumble beeOP
Hello everyone. i am trying to create a dashboard with tools similar to https://tinytool.net. For each tool i want to create a nextjs application and for the main dashboard i also want to create a seperate nextjs application (all inside docker containers)
I want to point a domain towards the first application, to make it available to the internet. i also want this application to handle authentication and session management
if possible i dont want to expose the other applications to the internet. i just want to serve their content within a different page of the dashboard application.

so far i have tried defining all tools in the file tools.ts, displaying them on the root page of the dashboard application and making a dynamic route [toolName] where i handle the rendering of the tool depending on the url path in form of an iframe

tools.ts
const getAllTools = () => {
const tools : ToolItem[] = [
{
toolName: "Tool1",
iconSrcPath: "/tool1.png",
href: "/tool1"
},
...

[toolName]/page.tsx
export default function ToolPage({ params: { toolName }}: Params) {
switch (true) {
case /^tool1/.test(toolName):
return (
<iframe className={styles.iframe} src="http://tool1:3001"></iframe>
);
default:
return <div>Tool not found</div>
}
}

it seems like my approach is not working because as much as i understood from trying this is, that i would have to expose the tools themselves to the internet. i am a beginner, when it comes to nextjs and webdevelopment in general so i would appreciate any sort of help. If you need any more information i will gladly provide you with it
Answered by riský
all i can say is from my view, is if they are pretty simple tools, they should just be under one nextjs project and save yourself all the chaos with it
View full answer

32 Replies

why do you want to make them as seperate nextjs apps instead of just subpages?
Large garden bumble beeOP
it is a requirement. i guess it will be more modular and the different instances are independent of each other
but i dont see the point of nextjs here if every page is just different instance...
however, you can try to use rewrites to proxy your other app through your main (but i think this would break as the styles and so dont get sent...)
and in this example tools site you shared, there is still lots of shared components like styles, which is what is making me so confused on this requirement
Large garden bumble beeOP
i started the project with the intention to make subpages for the tools, then somebody of my created a tool inside a next application, which would have been a pain in the ass to merge, and then it was decided to from now on create a seperate nextjs application for each tool
@riský but i dont see the point of nextjs here if every page is just different instance...
Large garden bumble beeOP
may i ask what you would do in my place?
well how are you doing everything... each app/tool has their own js and css bundle and you copy some styles?
and i really would try to just make everything work in one nextjs, so i haven't really thought about it
so how dynamic is your pages @Large garden bumble bee
like can they be exported to individual html files
or is there upload and fetch from db things
also i wonder how this one tool caused chaos enough that its easier to make many projects instead
@riský well how are you doing everything... each app/tool has their own js and css bundle and you copy some styles?
Large garden bumble beeOP
currently the tools are independent of each other regarding css and js bundles
@riský so how dynamic is your pages <@205705968032415744>
Large garden bumble beeOP
i see
it was a question... how dynamic/static are they
@riský or is there upload and fetch from db things
Large garden bumble beeOP
i have a few fetch requests
ok so you would need actual server
@riský it was a question... how dynamic/static are they
Large garden bumble beeOP
sorry marked wrong message
and whats wrong with exposing the other projects online as you would have to for them to be acccessed
@riský also i wonder how this one tool caused chaos enough that its easier to make many projects instead
Large garden bumble beeOP
i think one or two prblems with dependencies but other than that mostly css. i felt a bit lost but as it is know i might aswell try again
if css is the issue, you can use css modules to ensure that only that css is loaded on specific page
@riský and whats wrong with exposing the other projects online as you would have to for them to be acccessed
Large garden bumble beeOP
i figured it might be easier. if they are not exposed i only have to do session management for the main dashboard
all i can say is from my view, is if they are pretty simple tools, they should just be under one nextjs project and save yourself all the chaos with it
Answer
otherwise you have to do so much weirdness to make it work
like you can use the rewrites from main project and change basepath in other ones (and maybe assetPrefix to the proxied path if needed)
and that isnt even dealing with your auth thingy :(
Large garden bumble beeOP
true
well thank you for helping me out :)
i guess ill go with trying to merge the tools into the main application one more time
yay