ampp
ampp12mo ago

Next.js templates

is the fullstack task management (nextjs) template still containing best practices considering there has been 10 convex releases since then?
20 Replies
Michal Srb
Michal Srb12mo ago
Templates
The backend application platform with everything you need to build your product.
GitHub
GitHub - Nutlope/notesGPT: Record voice notes & transcribe, summari...
Record voice notes & transcribe, summarize, and get tasks - Nutlope/notesGPT
Templates
The backend application platform with everything you need to build your product.
ampp
amppOP12mo ago
fullstack https://github.com/get-convex/fullstack-convex is on the convex.dev/templates. The notesgpt is like 10 times less complex then the fullstack. My problem is the fullstack template is much closer to our needs in complexity because our app design is going to be way more complex then full-stack by several multiples. I'm mainly wondering if its still proper design to do the object conversion like the tasks table gets in the template. But maybe someone can chime in generally what would need to get changed.
GitHub
GitHub - get-convex/fullstack-convex: Fullstack.app implementation ...
Fullstack.app implementation using Convex / Auth0. Contribute to get-convex/fullstack-convex development by creating an account on GitHub.
Michal Srb
Michal Srb12mo ago
There’s also https://github.com/xixixao/saas-starter If you’re going for something complex.
GitHub
GitHub - xixixao/saas-starter: Convex, Clerk, Next.js, Convex Ents
Convex, Clerk, Next.js, Convex Ents. Contribute to xixixao/saas-starter development by creating an account on GitHub.
Michal Srb
Michal Srb12mo ago
The fullstack template also follows our best practices (despite being a little older), it uses Convex 1.0 which is the version that’s guaranteed to work. Later releases mainly added functionality.
ampp
amppOP12mo ago
Yeah, that one would have been nice to see a week or two ago, its still simple in comparison to fullstack. I figured i might as well try to do a local install of it, and fullstack does seem to work on covex 1.10 without issue. The only problem is auth0, i couldn't find any sepctific instructions but i got signed in etc. It just cant auth my user to create a task. Even though the convex user table looks properly populated. So maybe a auth0 problem.
Michal Srb
Michal Srb12mo ago
Docs for Auth0 and Convex: https://docs.convex.dev/auth/auth0
Convex Auth0 | Convex Developer Hub
Auth0 is an authentication platform providing login via
ampp
amppOP12mo ago
One thing i noticed so far is the use of ctx.table("table").getX, i was trying to search the docs for what is different about that but the search engine is returning nothing. also what is .edge cant seem to find that in documents either.
ampp
amppOP12mo ago
ive spent probably 10 hours just looking at webdevcody's stuff, antonio's notion-clone, your fullstack, and about 5 other templates to try to infer the best practices. only to find this https://labs.convex.dev/convex-ents/schema 😅 .. i havent dug into it but it sure looks like most of these examples could use some upgrades
Ent Schema - Convex Ents
Relations, default values, unique fields and more for Convex
ampp
amppOP12mo ago
i added the ents to my project and am going to convert everything. looks like the future of all new templates. We need RLS and some very advanced permission structures eventually, we were looking at using cerbos. But not sure how easy that will be vs making our own setup. Anyway right now im going to use fullstack as a template for tasks, and eventually add on 30+ tables to achieve a very novel and unique system of task management & more .
Michal Srb
Michal Srb12mo ago
@ampp sounds like you found the Ents documentation a bit too late, but it is linked from the saas-starter README. Maybe I need to make it even more prominent. Let me know if you have any feedback for the Ents docs. Here or file away: https://github.com/xixixao/convex-ents/issues
GitHub
Issues · xixixao/convex-ents
Contribute to xixixao/convex-ents development by creating an account on GitHub.
ampp
amppOP12mo ago
so far when i installed it, i had to run npm install convex-ents separately, it was the only package not retrieved by npm install. then also the init.ts file didnt run so the database was entirely empty. ugg i cannot figure out how to run that init.ts manually. id enter it manually but not sure how to make the relationships in the db manually.
Michal Srb
Michal Srb12mo ago
Thanks for reporting @ampp! 1. The package-lock.json was corrupted. You should delete it, delete your node_modules and install again 2. You can initialize the database with npx convex run init:init . 3. I upgraded the dependencies and added the instructions to README, so if you pull and redo the install it should all work now. Apologies for the rough experience!
ampp
amppOP12mo ago
Ill try it later, I feel silly that the hardest problem has been the simple function during converting my first couple tables and cant get const channels = await ctx.db .query("chatChannels") .filter((q) => q.eq(q.field("teamId"), team?._id)) .collect(); changing to: await ctx.table("chatChannels").filter((q) => q.gt(q.field("teamId"), team._id)) as per the docs. but its now a edge thing so tried using a index too. no error, but it does return a blank object of the entire schema which is weird. starting with: _PromiseQueryOrNullImpl [Promise] { ctx: { db: {etc etc and my table for refernce: chatChannels: defineEnt({ name: v.string(), }) .edge("team") .edges("chatMessages", { ref: true }),
Michal Srb
Michal Srb12mo ago
@ampp can you open a new #support-community thread? You probably want await team.edge("chatChannel") based on your schema.
ampp
amppOP12mo ago
ok, one random question is that it seems like its fairly standard to name indexes by prefixing by is there a reason its not done like that with the ents examples? preference? It's basically because im doing a 2 step migration, first edit the schema, then try to make minimal(that tends to be changing the by) edits for the old ctx.db stuff, then go through and rewrite.
Michal Srb
Michal Srb12mo ago
I think we internally somewhat regret establishing the by_ precedent. Argument for by_: 1. Index names look different to field names Arguments against: 1. Changing casing is weird (and we have been inconsistent and often use by_someField instead of by_some_field) 2. For helpers like Ents and convex-helpers its more complicated if the index names don't align with the field names for simple indexes But really the index names don't matter much.
ampp
amppOP12mo ago
I'm fairly indifferent, its nice to not confuse things its more obvious its a index when its field1_field2. I'm guessing just using a leading underscore would be _fieldindex would make some naming convention people mad. Whatever the case i think ent should be more known, i really don't see why it shouldn't be built in but i am far from a expert. I think the best way to show it off is convert fullstack to ents and then it really shows how much code it can cut.
burnstony#1975
burnstony#197511mo ago
I don't see Ent Schema mentioned here https://docs.convex.dev/database/schemas What's the best practice - should I use Ents?
Schemas | Convex Developer Hub
Schema validation keeps your Convex data neat and tidy. It also gives you end-to-end TypeScript type safety!
ampp
amppOP11mo ago
Yeah i think it should be on there. https://labs.convex.dev/convex-ents Its worth it the more relationships in the data you have or a RLS setup. Its like another level up to what covex is about. Its just going to be harder to find examples of every scenario, that's where i am struggling with a little but im lacking good experience with objects.
Convex Ents - Convex Ents
Relations, default values, unique fields and more for Convex
Michal Srb
Michal Srb11mo ago
@burnstony#1975 the answer to this question might be helpful for you: https://discord.com/channels/1019350475847499849/1202403482930249789/1221918250691068017

Did you find this page helpful?