Part 1: Exploring the Database Structure of Violet Verse CMS  

line

Violet Summer

By Violet Summer

BY VIOLET SUMMER

star

March 11, 2024

MARCH 11, 2024

star

Last updated March 12, 2024

Choosing MongoDB for Flexibility and Efficiency  

Ever wondered what happens to your content when it disappears from your favorite website? As a website owner, managing content efficiently becomes paramount. When I was a journalist publishing for many different platforms, I was faced with the problem that I would never be able to own my content. Even running my own blog site on Google's Blogger and WordPress was not enough to have full control over my words. 

This dilemma led to the creation of Violet Verse, a content management software designed to streamline the content creation process for modern publishers. Unlike traditional platforms like Google, Squarespace, or Wordpress, which often require cumbersome plugin support and lack ease of access to content, Violet Verse is built for explorers who want to do more with their content and be able to preserve the lifespan of their words in general. 

Database Management and Flexibility  

I get asked about the database management and why don't I just use a Wordpress. The answer is somewhat simple, however, at the core of Violet Verse's architecture lies MongoDB, a NoSQL database. Unlike conventional SQL databases, MongoDB stores data in flexible, JSON-like documents with dynamic schemas known as BSON. This design choice offers several advantages when it comes to storage, scalability and performance.

Here are a few that resonate to content publishers of blogs and websites: 

1. Database Management: MongoDB efficiently manages Violet Verse's data, facilitating storage, updating, and retrieval operations seamlessly. 

2. Document-Oriented Storage: Data in MongoDB is stored in flexible documents, allowing for versatile data modeling compared to rigid SQL structures.

3. Schemaless Design: MongoDB's schema-flexible nature eliminates the need to predefine data structures, enabling agile development and evolution of the data model over time.

4. Scalability: MongoDB scales horizontally across multiple servers, ensuring Violet Verse can handle large volumes of data and high traffic loads effectively.

5. Performance: MongoDB is known for its high performance, especially with complex queries and large datasets, enhancing Violet Verse's efficiency.

This is relevant in a world where more than 6 million pieces of blog content are produced on a daily basis. The sheer volume of content storage is massive. And yet when it comes to organizing this content, there are so many issues at stake. I've found that having a flexible data document architecture will not only be relevant but easy to research and find recurring topics that evolve within the Violet Verse world. 

Leveraging MongoDB for Violet Verse

By integrating MongoDB into Violet Verse's architecture, the software gains access to MongoDB's robust features for efficient and flexible data storage and management. This choice empowers Violet Verse to adapt to evolving industry content standards and scale effortlessly as needed.

If you’re new to MongoDB it is fairly simple to connect, and we use a connection code that represents a cluster. Here are a few differences between the databases:

 

SQL

NonSQL

Relational Database – It’s similar to Excel. Schemas are very strict and cannot scale. Most SQL only scale up vertical, and as your database grows you have to spend money on servers. 

NonRelational Database. There are several types of these databases like Tables, rows and columns, and documents in Json or Bson format as per MongoDB. The

Vertical Scaling Only

Horizontal 

Cluster

Cluster 

Table

Collection

Row

Document

Column

Field 

Server required 

Serverless , Violet Verse 

 

Connecting with MongoDB and Data Indexing 

For those new to MongoDB, establishing a connection is straightforward. Violet Verse employs a connection code representing a cluster, simplifying the setup process. This code is a Next.js server-side function (getServerSideProps) that fetches data from our personal MongoDB database and prepares it to be passed as props to a Next.js page component.

 Here's a breakdown of what each part of the code does:

import { Box } from "@mui/material";
import ArticleGrid from "../../components/article/ArticleGrid";
import connectDatabase from "../../lib/mongoClient";
import { getUsersByRole } from "../api/database/getUserByEmail";

Inside the getServerSideProps function:


export async function getServerSideProps() {
const db = await connectDatabase();
const collection = db.collection("posts");
const data = await collection.find({ hidden: false }).toArray();

const authors = await getUsersByRole("admin");
const contributors = await getUsersByRole("contributor");

return {
props: {
posts: JSON.parse(JSON.stringify(data)),
authors: authors,
contributors: contributors,
},
};
}

As you can grasp from the above, you'll see that data is being fetched from our MongoDB post collection, which further shows how blog content is stored. Once you set up your MongoDB database with all the post information, you can start indexing the post data based on the various fields previously setup. This link shows how to query data in MongoDB

Setup your database to account for SEO

Below is a glimpse of VV's data structure, which consists of Post Title, Subtitle, Author ID by blockchain wallet, unique post content ID. I'd also like to note that this database structure can also double as a SEO strategy! When we use specific keywords to identify the content in an organize way, the content is more likely to rank higher with Google search. This is why VV has Title, Subtitle, and a TLDR to help shape the SEO outputs. 

screenshot of vv mongodb

Embracing Data Flexibility  

In an era of evolving content standards, data flexibility is paramount. Violet Verse's adoption of MongoDB underscores its commitment to adaptability and efficiency in managing diverse content types. The decision to utilize MongoDB as Violet Verse's database management system stems from its unparalleled flexibility, scalability, and performance. By leveraging MongoDB, Violet Verse empowers content creators with a robust platform capable of meeting the dynamic demands of modern content management.

Interested in exploring the VV repo? Check us out on Github here.

Email us at gm@violetverse.io to build and grow your content and community platform. 

line

More From

line
line

More From

line

Education