Fredy  Larson

Fredy Larson

1594195841

Jamstacking a free CMS site with Svelte/Sapper, Netlify and FaunaDB

In this tutorial, we’ll build a small content website based on the Sapper template from Nicholas Christ, and modify it to use FaunaDB as storage and Netlify as free host. It uses Svelte and Tailwind CSS to make creating and designing webpages very clean and easy.

The first part is just an easy starter so everyone can follow along. You need some git knowledge (or use a git gui). It’s up to you to take it to the next level.

Here’s the plan:

  1. Clone template repository
  2. Build/run/push back
  3. Deploy to Netlify
  4. Add FaunaDB & posts
  5. Glueing it together

You can do step 2 after you add FaunaDB, but I was happy to see it running on the net first and then adding features later.


1. Clone the repository

I started from https://github.com/nhristov/sapper-template-rollup, a modified Sapper template, that uses postcss, purgecss, cssnano, tailwindcss and svelte-preprocess.

GitHub repository with modified Sapper project

The original sapper-template-rollup

Create repository from an existing one on GitHub

Create a new repo from an existing one

Once you set it up on GitHub, you need it on your machine. Clone the repo via the command line if you’re familiar with it, or you can drag the url from your browser in a gui like Tower or SourceTree.

Clone Remote Repository dialog box from Tower GIT client

Open the project in your editor of choice, I use WebStorm, and in a terminal type npm install to install any dependencies that are needed. If you see mention of vulnerabilities, type npm audit to fix those before you continue.

2. Build, run and push back

Now you can build your project and run it locally. You do this with npm run dev and if all goes well you’ll see the http://localhost:3000 link appear. Test it in your browser.

Image for post

I tried this sample project on 2 machines, one succeeded and the other failed. At first, I couldn’t figure out why… a call for help to the guys at Hackages resulted in the solution: make sure to run thelatest nodejs_ on your machine. At the time of writing this was 14.2.0. Problem solved._

Browser output of Svelte/Sapper template project

Our project running locally

Click around in the top navigation and notice how snappy it works. On the blog page you’ll find a list of articles. That is the list we will convert to the FaunaDB online data store.

Let’s change something on the first page, just to make sure our updating works. Open the /src/routes/index.svelte file in your editor, and change the main title to

We did it!

or something similar.

WebStorm editor with Svelte file loaded

When you save the index.svelte file, your browser should update and show the changes you made.

Image for post

Committed and pushed the change to the title

Now commit the changes to git and push it to your repo on github.

#svelte #programming #netlify #jamstack #cms

What is GEEK

Buddha Community

Jamstacking a free CMS site with Svelte/Sapper, Netlify and FaunaDB
Fredy  Larson

Fredy Larson

1594195841

Jamstacking a free CMS site with Svelte/Sapper, Netlify and FaunaDB

In this tutorial, we’ll build a small content website based on the Sapper template from Nicholas Christ, and modify it to use FaunaDB as storage and Netlify as free host. It uses Svelte and Tailwind CSS to make creating and designing webpages very clean and easy.

The first part is just an easy starter so everyone can follow along. You need some git knowledge (or use a git gui). It’s up to you to take it to the next level.

Here’s the plan:

  1. Clone template repository
  2. Build/run/push back
  3. Deploy to Netlify
  4. Add FaunaDB & posts
  5. Glueing it together

You can do step 2 after you add FaunaDB, but I was happy to see it running on the net first and then adding features later.


1. Clone the repository

I started from https://github.com/nhristov/sapper-template-rollup, a modified Sapper template, that uses postcss, purgecss, cssnano, tailwindcss and svelte-preprocess.

GitHub repository with modified Sapper project

The original sapper-template-rollup

Create repository from an existing one on GitHub

Create a new repo from an existing one

Once you set it up on GitHub, you need it on your machine. Clone the repo via the command line if you’re familiar with it, or you can drag the url from your browser in a gui like Tower or SourceTree.

Clone Remote Repository dialog box from Tower GIT client

Open the project in your editor of choice, I use WebStorm, and in a terminal type npm install to install any dependencies that are needed. If you see mention of vulnerabilities, type npm audit to fix those before you continue.

2. Build, run and push back

Now you can build your project and run it locally. You do this with npm run dev and if all goes well you’ll see the http://localhost:3000 link appear. Test it in your browser.

Image for post

I tried this sample project on 2 machines, one succeeded and the other failed. At first, I couldn’t figure out why… a call for help to the guys at Hackages resulted in the solution: make sure to run thelatest nodejs_ on your machine. At the time of writing this was 14.2.0. Problem solved._

Browser output of Svelte/Sapper template project

Our project running locally

Click around in the top navigation and notice how snappy it works. On the blog page you’ll find a list of articles. That is the list we will convert to the FaunaDB online data store.

Let’s change something on the first page, just to make sure our updating works. Open the /src/routes/index.svelte file in your editor, and change the main title to

We did it!

or something similar.

WebStorm editor with Svelte file loaded

When you save the index.svelte file, your browser should update and show the changes you made.

Image for post

Committed and pushed the change to the title

Now commit the changes to git and push it to your repo on github.

#svelte #programming #netlify #jamstack #cms

Fredy  Larson

Fredy Larson

1594199520

Jamstacking a free CMS site

In the second and final part of this tutorial, we’ll finish up by adding FaunaDB to our stack and integrating it in the Svelte/Sapper site.

If you remember from the first part, here’s the plan:

  1. Clone template repository
  2. Build/run/push back
  3. Deploy to Netlify
  4. Add FaunaDB & posts
  5. Glueing it together

We already tackled 1, 2 and 3. Let’s go!


4. Add FaunaDB to the mix

Faunadb is a serverless database. It starts with a free account, and very generous limits. It’s fast, global and easy to implement.

Sign up for free, then follow the short onboarding tutorial — highly recommended.

When you’re ready, let’s create a new database. For this tutorial, we’ll use the same name (sapper-cms) again. Do not check the box for demo data, we don’t need that.

FaunaDB new database window

Create new database in FaunaDB

Next we need a table to hold our blog posts. Tables are called Collections here, so click on New Collection and give it the name posts. Don’t change the History Days and TTL options, we don’t need it.

FaunaDB New Collection window

Adding a new collection (table) to our database

Now we have a new collection without any documents (=rows in a table) and no indexes.

To add a new document, we can use the web interface of FaunaDB, but ultimately that is not what we want. At some point in time we want this to happen behind the scenes.

On the other hand, adding an index is something that happens usually only when setting up the database, so we can already do it from here.

FaunaDB collection posts windows

In the New Index dialog, give a name like posts-by-title, and fill in the first edit box of Terms with title. It will change into data.title when you save it.

FaunaDB New Index window

Now comes the hardest part. Programmatically adding the data from our blogposts to our new collection. Open the file /src/routes/blog/_posts.js and you’ll see that the blog posts from our site are stored in there as some kind of js format.

WebStorm with .js file loaded

Unfortunately we’ll need to massage this a bit until we can use it for FaunaDB: On the left side in the FaunaDB Console you can click on Shell. This opens a black terminal at the bottom and a blue results window on top of it. Click on [Run Query] to execute whatever is in the terminal.

FaunaDB Shell terminal

It took me a bit of digging in the FaunaDB online help to find the correct usage of functions, but this is the notation of how you can add multiple documents with multiple fields in 1 operation:

Map(
    [
        [ "title 1", "slug-1", "content 1\n" ],
        [ "title 2", "slug-2", "content 2\n" ],
        [ "title 3", "slug-3", "content 3\n" ],
    ],
    Lambda(
        ["post_title", "post_slug", "post_html"],
        Create( Collection("posts"),
            {
                data: {
                        title: Var("post_title"),
                        slug: Var("post_slug"),
                        html: Var("post_html")
                    }
            }
        )
    )
)

#cms #faunadb #netlify #jamstack #svelte

Landen  Brown

Landen Brown

1625882340

Up and running with JAMstack CMS

Learn about how to get up and running with JAMstack CMS in this 25 minute video capture from the Twitch.tv live stream.

https://github.com/jamstack-cms/jamstack-cms

#cms #jamstack #jamstack cms

Aarna Davis

Aarna Davis

1622794592

Comparative Analysis of Top 10 Famous CMS Platforms in 2021

Comparing Top 10 Popular CMS platforms for website development such as WordPress, Wix, Drupal 8.1, Joomla 3.5 to choose the best.

Read this blog here:
https://www.intercoolstudio.com/a-comparative-analysis-of-top-10-popular-cms-platforms/

#hirecmsdevelopers
#HireCMSprogrammers
#bestcmsfordevelopers
#HireCMSdevelopersIndia
#HireCMSprogrammersIndia
#DedicatedCMSdevelopers

#hire cms developers #hire cms programmers #best cms for developers #hire cms developers india #hire cms programmers india #dedicated cms developers

Ashley Troy

1618240774

Role of Professional Brand Consulters to Make Your Brand Successful

Each company wishes to remain present in the industry, and for that purpose, it indulges in user profile creation sites list to become popular in the online field. To achieve this, however, you need robust and productive strategies to maintain your existing customers’ loyalty. These plans should also attract new customers at precisely the same time.

Only the latest consulting firms are effective enough to observe the suitable approaches that can help you transform your business into your favourite brand. At Vowels Advertising in Dubai, Abu Dhabi, we offer various courses and suggestions to help your business and building to be effective by becoming a brand consultant. Branding advisers build new communication methods and a new identity. These advisers offer the brand of goods as required. They research your brand, which is made up of its identity and values. Brand Advisors have fantastic ideas and approaches to branding your products.

The most significant advantage of hiring a new consulting firm is that it has years of experience combined with the latest construction approaches. Since then, such companies are used to market trends and are continually being improved; they can quickly assess the competition and track competitor companies. In this way, they can analyze the manufacturer’s promotional requirements and evaluate the market to target a new product more effectively.

None of the other popular brands you see in the market today have started on a large scale right from the start. They achieved their present position thanks to ongoing trials and planned procedures. The whole long-term strategy was to introduce a new identity, place it precisely in the current market, and strengthen it by copying it to acceptable masses. Planning these elements and then implementing them appropriately is not a simple job. That is why companies from all over the world employ new consulting companies to implement the project.

If best, a new consulting firm can be tricky as there are an endless number of firms offering such services? The key to finding the perfect supplier for you is to analyze your condition first. As soon as you write down all the things, you can compare providers on the Internet and look for any gaps that may be useful to you. Also, start looking for reviews and connect with all previous customers to find out how satisfied they were with all the services.

By opting for Enterprises, they are responsible for creating the perfect brand identity for virtually any business, placing or repositioning it according to the market in which it operates, designing campaigns that advertise the business professionally and economically, and conducting thorough target market, competition, and market research. Thanks to all these activities, companies help to establish a small business and increase its visibility on the market. In the case of your small business, you can undoubtedly see it grow and reach a wider audience. You can find suitable new employees for a consulting company.

So this is how you can hire professional brand consulters to promote your brand amongst the customers effectively.

#profile creation sites #profile creation sites 2021 #profile creation sites list #high pr profile creation sites #free profile creation sites list #high da profile creation sites