W
Wasp-lang6mo ago
dank

Custom Frontend React Template

Hi there, I've recently stumbled across WASP/MAGE and you all have done a great job with this! I have a couple questions that I'm hoping you can help me with: Custom React Styling? I have a React template with pages and components comprised of TSX files that I would like to use, so is it possible to load/replace those components into the MAGE/WaspAI before rendering? GPT 4 or 4 Turbo? I have ChatGPT Plus so I have access to GPT 4 and GPT 4 Turbo, I've seen some posts that outline how to use MAGE with GPT 4, and I'm assuming I can do the same with GPT 4 Turbo, but is there any real advantage to it? Like have you found that the code is less error-prone, more intuitive, etc? I understand and accept that I might have to set up a local copy of MAGE to do these things if that is what is needed. Thank you in advance!
7 Replies
Vinny (@Wasp)
Vinny (@Wasp)6mo ago
So, yes, you can customize whatever Mage gives you with your pre-built react components. In the end, Mage gives you a Wasp app, which is essential a react + nodejs fullstack app so you can customize it as you would a normal react + nodejs app, with some caveats to account for Wasp. And we’re currently working on testing mage with GPT 4 turbo. At the moment it seems there’s no clear benefit over our current confoguration. But using GPT 4 entirely with Mage can output slightly better code
dank
dank6mo ago
Cool, that makes sense, thanks! Also, is there a guide to running MAGE locally? I'm guessing that using GPT 4 Turbo would allow for more complex applications since the token cap is much larger, have you found that to be true?
matijash
matijash6mo ago
yes, you can run it locally - check out the instructions in the last question of FAQ at usemage.ai 🙂 Re GPT 4 Turbo - in theory yes! As @Vinny (@Wasp) said, we're now in the process of testing so we should know more soon.
No description
dank
dank6mo ago
Awesome, thank you for the info! To be clear, WASP is to React/Node as Rails is to Ruby, correct? Or at least that's the goal? Also, defining an "api" in the main.wasp file is like combining and route and a query together right? How is the authentication handled for that?
MEE6
MEE66mo ago
Wohooo @dank, you just became a Waspeteer level 1!
martinsos
martinsos6mo ago
Actually, bigger context of GPT 4 Turbo doesn't help us -> we are not limited by the context size currently, but by the intelligence of the GPT. COntext size might become more important once we add "debugging" feature to Mage, but for now, it is not a bottleneck at all. Yes, that is correct! it is a full stack framework.
martinsos
martinsos6mo ago
So for most communication between client and server you will want to use Actions/Queries. But, if you need something custom with more control, or you want to expose a public API, then you use api feature. It is a lower-level thing. If you check the docs here https://wasp-lang.dev/docs/advanced/apis#api-reference you will notice api has auth field, which if set to true will do the similar/same thing as Actions/Queries do -> it will check who the user is and put it in context.user for you so you can make further decisions if you are going to let that user do what they want or not.
Custom HTTP API Endpoints | Wasp
In Wasp, the default client-server interaction mechanism is through Operations. However, if you need a specific URL method/path, or a specific response, Operations may not be suitable for you. For these cases, you can use an api. Best of all, they should look and feel very familiar.