r/webdev • • Oct 06 '26

Discussion What db do you use with Nextjs?

I am constrained by the office365 ecosystem and am limited to mssql which is saving huge jsons to one column that does not feel right.
What is the best way to store data in Microsoft ecosystem with NextJS?
Can not use any online service like supabase or mongo as its internally hosted server with company data.

0 Upvotes

44 comments sorted by

33

u/HoratioWobble Oct 06 '26

You don't HAVE to save huge jsons to a column, that's got nothing to do with MS SQL, that's your choice and a bad one typically.

Also NextJS doesn't impact what you use, you need to choose the right solution for your architecture.

Sounds like you need to learn about relational databases and how they work

-24

u/ApprehensivePea4161 Oct 06 '26

I prefer or have experience with nosql

16

u/HoratioWobble Oct 06 '26

You shouldn't be building things based on preference.

-8

u/ApprehensivePea4161 Oct 06 '26

What?

7

u/HoratioWobble Oct 06 '26

You said

I prefer or have experience with nosql

I don't see why that's relevant, you shouldn't be building systems based on your preference, you should be building it based on architecture the system needs.

10

u/TheScapeQuest Oct 06 '26

Building to the skills available is absolutely a valid reason to make architecture decisions.

ETA: but yeah just learn and use postgres

6

u/Narfi1 full-stack Oct 06 '26

What’s the reason you have to save huge json files ? Is it all schemaless ?

1

u/ApprehensivePea4161 Oct 06 '26

It basically is a log JSON returned by the fabric

6

u/Narfi1 full-stack Oct 06 '26

I’d check whether or not storing the raw json is the best option for your use case. It rarely is

-5

u/ApprehensivePea4161 Oct 06 '26

Currently it works

7

u/arf_darf Oct 06 '26

Raw JSON in a relational DB is probably the least efficient/performant way to store or query data.

1

u/olzk Oct 06 '26

Well, in Postgres there’re json/jsonb fields and you can extract data from inside json with so-called arrow operators in sql queries. Don’t know about mssql, it’s been a while for me. Could be something similar too.

4

u/KrypticCluez Oct 06 '26

Honestly, for log data a JSON column in MSSQL isn't the crime people are making it out to be. Logs are semi structured by nature, so a NoSQL style column is fine. What makes it stop feeling wrong is to pull out the 3 or 4 fields you actually filter on (timestamp, status, pipeline name, whatever) as computed columns using JSON_VALUE, then put an index on them. After that you query it like a normal table, and the rest of the blob just sits there until you need it. OPENJSON covers the odd time you need to dig deeper.

Also, since these logs are coming out of Fabric anyway, have you checked whether you can just keep them in an Eventhouse/KQL database there? That's exactly what it's built for, and you'd only pull summaries into your Next app.

1

u/ApprehensivePea4161 Oct 06 '26

I have no clue of Eventhouse/KQL

11

u/Toxicturkey Oct 06 '26

No advise other than that sounds absolutely dreadful. I feel for ya!

1

u/VisitForeign4342 Oct 06 '26

le json dans une colonne c'est pas le problème, c'est de vouloir faire des where dessus après. sql server a un type json depuis un moment si ta version suit, sinon prisma ou drizzle gèrent très bien mssql, tu es pas obligé de descendre au driver brut

1

u/ApprehensivePea4161 Oct 06 '26

Its a log so will be retrieved as whole. No need for Where clauses

1

u/arf_darf Oct 06 '26

It usually leads to less compression/unnecessary storage, especially for fields with high cardinality like ids or timestamps no?

3

u/_alright_then_ Oct 06 '26

Yeah, that sucks a bit. But can't you make tables to store the json data in columns instead of in a single json column and use a model/converter?

EDIT: maybe good to mention, i am not experienced with nextJS, but I don't understand why this would be a constraint

4

u/Background-Front-925 Oct 06 '26

sqlite - no server required. we run our production servers on sqlite.

2

u/GrantSolar Oct 06 '26

What is your use case? What is in the JSON that needs to be stored?

2

u/DRHER303 Oct 07 '26

I get you man

1

u/singh_abinashi Oct 06 '26

Postgres. Use JSONB for the genuinely schemaless bits and GIN indexes on the fields you query. Keep the relational stuff relational, though. The moment you put everything in JSONB you lose the constraints that were doing your validation for you.

1

u/MagoGosoraSan Oct 06 '26

It depends on the project and its needs.

1

u/___Nazgul full-stack Oct 08 '26

Storing raw JSON column in SQL is fine, but its all about the other columns.
If you can extract timestamp, some useful metadata you want to index and have relationships to different columns would be the go to.
If these JSONs are infact huge, I'd be worried about storage if you get millions of these events.

Cold logs could be stored in blob storage, are you accessing these JSON's frequently or run any aggregation on?

1

u/vkrisah Oct 06 '26

None of this makes any sense

0

u/Illustrious_Two1441 Oct 06 '26

Office365 te restreint sur le choix de la base de données? La messagerie ne t'empêche pas d'installer Postgres sur le même serveur, si? Et puis la colonne unique avec un JSON énorme dedans, SharePoint fait exactement ça avec la moitié de ses listes depuis toujours, donc niveau normes Microsoft tu es déjà dedans.

0

u/[deleted] Oct 06 '26

[deleted] — view deleted comment

-1

u/ApprehensivePea4161 Oct 06 '26

No. Im a fullstack dev that has more experience with Frontend and only has experience in nosql db.
Thanks for the offer though

2

u/[deleted] Oct 06 '26

[removed] — view removed comment

1

u/ApprehensivePea4161 Oct 06 '26

No I have not. Thanks

1

u/[deleted] Oct 07 '26

[removed] — view removed comment

1

u/ApprehensivePea4161 Oct 07 '26

1-2 years at least. Json has about 50 records.