One Weird Trick to Try @parcel/css on CodePen

Ideally, we’d just offer @parcel/css as a CSS processor choice right in our editors. We could absolutely do that, but we’re smack in the middle of a bunch of next-gen CodePen stuff, and we’re keeping our efforts focused there. Never fear, interesting new processors like this will be there along with it. But this CSS processor caught my eye especially because it’s a very fresh, modern, and interesting take on CSS processing. It handles vendor prefixing on its own (something you might otherwise use Autoprefixer for), it handles “syntax lowering” (love that term) for future-syntax CSS (like you’d use postcss-preset-env for), offers scoping, and even has its own built-in minifier, while being super fast. Nice!

So what if you do wanna try it on CodePen? Well, it’s actually possible because they have cleverly released the processor with a Wasm option, not just a backend-language-only thing. So here’s the plan:

Load the processor in the browser as a script (go Wasm go!)
Pull the CSS from the current Pen
Pass that CSS to the in-browser processor we just loaded
Get the transformed CSS
Replace the CSS in the preview with the transformed CSS

Check it:

CodePen Embed Fallback

The post One Weird Trick to Try @parcel/css on CodePen appeared first on CodePen Blog.

Flatlogic Admin Templates banner

Creating a Laravel Project

Laravel architecture
Laravel history
The Pros of Laravel
The Cons of Laravel
Getting started with your own Laravel project
Laravel for backend
Building Laravel Projects with Templates
Building Laravel Projects with Flatlogic

Laravel is a PHP-based backend framework. It follows the Model-View-Controller design pattern which explains many of Laravel’s pluses and minuses that we’ll detail further on. Users often credit Laravel with responsiveness, scalability, and a good community. But not everything is so simple. Like many backend frameworks, it can be abstract and unintuitive. That is if you don’t have anyone to guide you.

In this article, we’ll talk about the history of Laravel, how it emerged, and how it won its position. We’ll take a closer look at the peculiarities of working with Laravel, and sum up the reasons to choose it or avoid it. Finally, we’ll dive deeper than usual into the inner mechanism of a simple app, and show you the code so you’ll know how to properly grease the gears. Keep reading!

Laravel Architecture

As mentioned, Laravel follows the Model-View-Controller architecture pattern. In this system, the Model is the part that manages the database and the data logic. The View is the user interface and all its interactive functions. The Controller is what differentiates MVC software from earlier practices. It mediates between the Model and the View, and makes the two largely independent of each other. It means easier development and maintenance, easier project management, and reusability of components.

Laravel History

Laravel was published in 2011, and it is a little over 10 years old now. By that time Taylor Otwell, the creator of Laravel, had been using CodeIgniter for quite a while. CodeIgniter was a solid backend framework and holds a small market share to this day. However, it had issues with authentication. Whenever you wanted authorization with Google or Facebook that we now take for granted, it required additional software that was hard to find in ready form. Otwell released the beta version of Laravel on June 9, 2011. The early Laravel supported a lot of the things that were missing from most backend frameworks back then. Those included authorization, views, sessions, routing, localization, and more.

Modern Laravel complies with MVC principles. But back in 2011, it did not support controllers. It became a true MVC framework in September 2011, with the Laravel 2 update. Laravel 3 came with a built-in command-line interface called Artisan. Furthermore, it had a lot more capacity for managing databases. At that point, Laravel was something largely similar to what it is today.

Laravel’s Pros


Backend frameworks have a reputation for being harder to grasp. While subjective, this approach has a grain of truth to it. Backend processes happen behind the scenes. They aren’t as easily demonstrable as front-end processes, and can thus be unintuitive. Laravel’s simple syntaxis and extensive use of plain PHP are a nice change of pace and a great opportunity for aspiring backend developers.


Laravel is often credited for data security. One of the contributing solutions is the Eloquent ORM. This object relational mapper is included in the package and adds another abstraction level to the code. It presents data as objects making the data exchange safer and more efficient. Furthermore, Laravel can store passwords in encrypted form out of the box. Together with the overall sturdy build, this makes Laravel a safe and reliable technology.

Time and Resource Efficiency

Laravel’s initial light weight is just one of the reasons why it saves storage space and computing power. Laravel is awesome when it comes to testing separate parts of the software rather than the whole project. Any time you fix a bug, this feature of Laravel will save just a little time. But if you have to fix lots of bugs, that’s a huge asset!

Effective Mapping

Laravel’s mapping is optimized for using relational databases. This makes relational databases easier to connect to Laravel backend, and they run smoother and faster than on some other frameworks.

Built-in CLI

Laravel’s built-in CLI called Artisan is a huge asset in creating command-line applications. Artisan is an advanced CLI that lets you include tasks and migrations without additional tools and resources.

Strict Logic

Laravel complies with the MVC (Model-View-Controller) architecture. This design is helpful for structuring the code into intuitive logical areas. MVC solutions are usually less susceptible to bugs and more compliant when it comes to debugging.

Quality Community

Laravel’s community is extensive and helpful. Plenty apart from the extensive FAQs, a lot of forums and dedicated platforms orbit Laravel making it very hard to come across an issue you won’t find a solution to.

Laravel’s Cons

Possible Compatibility Issues in Older Projects

Laravel has grown tremendously since its introduction but that came at a cost. Newer versions have an array of features that don’t work properly with older versions. This can make older Laravel projects glitchy and slow. In other words, the opposite of what we value the most about Laravel.

Minimum Tools Included

We’ve mentioned what a great CLI Artisan is. However, other parts of Laravel don’t boast the same diversity of tools and components. The downside of choosing a lightweight framework is the likelihood of having to implement additional tools and some glue code to make them work together properly. This is not a frequent occasion but can sometimes negate the light weight of Laravel.

Inconsistent Speed

Laravel doesn’t shine when it comes to speed. Competitors like Yii and Symfony outrun Laravel in most scenarios. Bear in mind, though, that Laravel’s operation on the latest PHP version with JIT compilation hasn’t been extensively tested. So keep your mind open, the latest Laravel might turn out to be much faster.

Getting started with your own Laravel project

When working with backend frameworks, it’s harder to keep track of your progress. That’s one of the reasons why backend frameworks get a reputation for being hard and unintuitive. We don’t think it’s fundamentally harder. We think it just requires a bit more initial training. Let’s start with basics and progress one step at a time.

Installing pre-requisite software

To fully use Laravel’s arsenal of features, you’ll need to install some useful tools, and learn to use them. Let’s start with Docker. Docker is a virtualization solution. It lets us run software in sandbox-like environments called “containers”. Docker runs your code internally, without affecting any other software on your PC or causing any compatibility issues. What runs in Docker, stays in Docker. We suggest getting Docker Desktop. The real reason we need Docker is Sail – Laravel’s built-in command-line interface. It integrates with Docker perfectly. This basic setup will let you run intermediate versions of your project with ease.

Setting up a Subsystem

This step is highly recommended for Windows users. A Linux Subsystem allows for running binary executables. This is the least troublesome way to test-run Laravel code on Windows. Launch your Windows Terminal, preferably in administrator mode, and launch the WSL. The process is simple: just type ‘wsl’ in the PowerShell or another CLI.

Creating the Project

Everything’s set for creating our own project. I’ll let myself be vain about it and call it Al’s Laravel project. Except, we want to avoid any possible compatibility issues, so the directory will be spelled ‘als-laravel-project’. To create a project, we use the CLI to go to the directory we need to create the project and print:

curl -s | bash

After a brief compilation, navigate your CLI again to the directory and move to the next step.

Creating the Project via Composer

This is another way to create a Laravel project. It has gained lots of popularity, and might be the most obvious method today. First, make sure you’ve installed both PHP and Composer. Then you can enter Artisan CLI and print the following:

composer create-project laravel/laravel example-app
cd example-app
php artisan serve

The above will create a local development server for Laravel.

Starting Sail

At this point, we can set up sail with one command. The ‘Sail Up’ command is easy enough to remember. Because we’re setting up our Sail, get it? If this is your first time launching Sail, the CLI will build application containers on your device. This takes a while but will make all subsequent Sail launches and operations faster. With the file structure there, you can access your application at http://localhost. In principle. This is just the structure of the future application and not the application itself. Let’s see what we can do next!

Primary Configuration

Laravel is often credited with the ease of setting up. Most Laravel projects require little to no initial configuration. However, you can explore the app.php file in the ‘config’ folder. It contains plenty of variables like Time zone, Laravel framework service providers, and URL Debugging. Like we said, most projects don’t require any configuration at this stage. If you’re just learning the ropes, we recommend learning to work with a basic Laravel project first. It will give you some context when you’re deciding how to configure the application.

Environment Configuration

Laravel supports developing, testing, and running your applications in different environments. Those include testing, deployment, production, and more. Adjusting your project for different environments happens by changing underlying parameters like caching directory. Environment variables are found in Laravel’s default .env file (or .env.example, depending on the method of Laravel installation that you’ve chosen).

Laravel for Backend

Laravel can be a great backend solution in many cases. Let’s list some of them!

Single-Page APIs

When building a single-page API, the small scale of the software built and the time spent implies a similarly minimalist approach to choosing the underlying technologies. We’ve mentioned how a Laravel project can be configured but in many cases that’s unnecessary. Laravel’s ease of configuration lets us create simple APIs in no time.

Next.js Applications

Next.js emerged to solve compatibility issues for Node – React applications, and that’s how it usually works. With Laravel, however, there’s another way to use Next.js. Laravel runs well as a backend of the Next.js application’s API. Laravel’s support of notifications and queues is impressive and helps use these features out of the box.

Semi-Full-Stack Framework

You might come across sources that claim Laravel to be a full-stack technology. That’s true to an extent. Laravel offers extensive possibilities for request routing. Also, if you’re interested in Laravel’s full-stack capabilities, take a closer look at Blade. Blade is Laravel’s integrated templating engine. It uses plain PHP which means no additional software will inflate your project. You can use Blade and transmit information to integral views lines. Laravel won’t work as a comprehensive front-end framework but brings along features that will be a great addition to plain JavaScript apps and landings.

Building Laravel Projects with Templates

Laravel is a highly popular framework so, naturally, there’s a huge supply of Laravel templates. One example is Flatlogic’s own Sing App Vue Template with Laravel Backend. Templates are possibly the easiest way to create a Laravel application. Especially considering the fact that many of those templates come with pre-installed front-end. The main challenge here is properly connecting all data endpoints to create a completely functional API.

To better understand how it works, we suggest trying the Sing App’s live demo. It is intuitive enough for most users to quickly understand how to manage a template-based application. Plentiful documentation will help resolve any issues and our support team is always ready to help you out here in case the documentation doesn’t cover it.

Building Laravel Projects with Flatlogic

Flatlogic Platform is our way of bridging the gap between developing your own apps and using templates. Applications running on the same technologies typically use the same elements and components. In many cases the main thing that makes them different on a technical level is the database schema that accommodates different mechanisms of data processing and storage. Flatlogic Platform allows creating applications by combining parts and building only the parts that need to be unique. It’s as easy as it sounds, and sometimes even easier. Keep reading to know more!

Step 1

The first page we see when creating our own project requires a name for the project and the tech stack. The name is pretty straightforward. Just pick one that is easy enough to associate with the project. The tech stack is the combination of technologies used in the project. The front-end, the database, and the backend to tie them together. Any combination will work fine, but given the article’s topic, we’ll choose Laravel as the backend technology.

Step 2

Next up, we’ll choose the design for our application. Currently, we’re redeveloping some visual options, so only the Material is available. But don’t worry, the others will soon be back and improved. Material design is Google’s design language used for UI compatibility of new software with Google services. Furthermore, its minimalist, unobtrusive nature works in most cases and for most users.

Step 3

The following page is the Database Schema that we mentioned earlier. The schema is the structure of the database that describes the relationships between columns, rows, and fields. This is an important part that largely defines how your application will process data. However, we’ve explored the more popular demands and included pre-built schemas perfect for eCommerce, Blogs, Social Networks, and more.

Step 4

Here we need to check if everything is according to plan. Check the stack, check the design, check the database schema, decide if you want to connect Git repository, and hit Finish.

Step 5

The next page offers us a plethora of ways to deploy and run our application. Deploy from scratch, deploy from GitHub… If you’re interested in the inner mechanisms of a Laravel application, you can view the actual code of the app.

Well done, sir or madam! You’ve created your very own Laravel App.


We’ve explained how to install Laravel and create your first project. That’s a solid first step for anyone who wants to learn Laravel development. For everyone else who needs a Laravel-based application but doesn’t have the time or the desire to learn the framework, we’ve offered two other routes. Both Laravel templates and Flatlogic Platform have a lot going for them. We might be biased but we usually recommend the Platform. It offers greater flexibility by allowing you to create applications with any combinations of technologies, designs, and database schemas.

Laravel is a controversial technology. It’s simple and beginner-friendly, but it requires additional research as you master Laravel development. It is one of the best and most versatile technologies including CLIs on the market yet can sometimes lack tools in other departments. We can definitely recommend Laravel to anyone who’s willing to learn backend development. Laravel offers plenty of features that speed up the development of compact, single-page applications, and large scale business solutions.

Related articles

Top 5 Admin Templates with Node.js Backend

Best Headless CMS in 2022

The post Creating a Laravel Project appeared first on Flatlogic Blog.

Flatlogic Admin Templates banner

Building a gRPC Server in Go


In this article, we will create a simple web service with gRPC in Go. We won’t use any third-party tools and only create a single endpoint to interact with the service to keep things simple.


This is the second part of an articles series on gRPC. If you want to jump ahead, please feel free to do so. The links are down below.

Introduction to gRPC
Building a gRPC server with Go (You are here)
Building a gRPC server with .NET
Building a gRPC client with Go
Building a gRPC client with .NET

The plan

So this is what we are trying to achieve.

Generate the .proto IDL stubs.
Write the business logic for our service methods.
Spin up a gRPC server on a given port.

In a nutshell, we will be covering the following items on our initial diagram.

? As always, all the code samples documentation can be found at: [](


This guide targets Go and assumes you have the necessary go tools installed locally. Other than that, we will cover gRPC specific tooling down below. Please note that I’m using some of the commands that are macOS specific. Please follow this link to set it up if you are on a different OS.

To install Protobuf compiler:

brew install protobuf

To install Go specific gRPC dependencies:

go install[email protected]
go install[email protected]

Project structure

There is no universally agreed-upon project structure per se. We will use Go modules and start by initializing a new project. So our business problem is this – we have a bookstore and we want to expose its inventory via an RPC function.

Since this talks about the creation of the server, we will call it bookshop/server

We can create a new folder called server for the server and initialize it by so:

go mod init bookshop/server

In a later post, we will also work on the client-side of this app and call it bookshop/client

This is what it’s going to look like at the end of this post.

Creating the service definitions with .proto files

In my previous post, we discussed what are Protobufs and how to write one. We will be using the same example which is shown below.

A common pattern to note here is to keep your .proto files in their separate folder, so that use them to generate the server and client stubs.


syntax = “proto3”;

option go_package = “bookshop/pb”;

message Book {
string title = 1;
string author = 2;
int32 page_count = 3;
optional string language = 4;

message GetBookListRequest {}
message GetBookListResponse { repeated Book books = 1; }

service Inventory {
rpc GetBookList(GetBookListRequest) returns (GetBookListResponse) {}

Note how we have used the [option]( keyword here. We are essentially saying the Protobuf compiler where we want to put the generated stubs. You can have multiple option statements depending on which languages you are using to generate the stubs for.

? You can find a full list of allowed values at [google/protobuf/descriptor.proto](

Other than that, we have 3 messages to represent a Book entity, a request and a response, respectively. Finally we have a service defined called Inventory which has a RPC named GetBookList which can be called by the clients.

If you need to understand how this is structured, please refer to my previous post ?

Generating the stubs

Now that we have the IDL created we can generate the Go stubs for our server. It is a good practice to put it under the make gen command so that we can easily generate them with a single command in the future.

protoc –proto_path=proto proto/*.proto –go_out=. –go-grpc_out=.

Once this is done, you will see the generated files under the server/pb folder.

Awesome! ? now we can use these subs in our server to respond to any incoming requests.

Creating the gRPC server

Now, we will create the main.go file to create the server.


type server struct {

func (s *server) GetBookList(ctx context.Context, in *pb.GetBookListRequest) (*pb.GetBookListResponse, error) {
return &pb.GetBookListResponse{
Books: getSampleBooks(),
}, nil

func main() {
listener, err := net.Listen(“tcp”, “:8080”)
if err != nil {

s := grpc.NewServer()
pb.RegisterInventoryServer(s, &server{})
if err := s.Serve(listener); err != nil {
log.Fatalf(“failed to serve: %v”, err)

We first define a struct to represent our server. The reason why we need to embed pb.UnimplementedInventoryServer is to maintain future compatibility when generating gRPC bindings for Go. You can read more on this in this initial proposal and on README.
As we discussed, GetBookList can be called by the clients, and this is where that request will be handled. We have access to context (such as auth tokens, headers etc.) and the request object we defined.
In the main method, we are creating a listening on TCP port 8080 with the net.Listen method, initialize a new gRPC server instance, register our Inventory service and then start responding to incoming requests.

Interacting with the Server

Usually, when interacting with the HTTP/1.1-like server, we can use cURL to make requests and inspect the responses. However, with gRPC, we can’t do that. (you can make requests to HTTP/2 services, but those won’t be readable). We will be using gRPCurl for that.

Once you have it up and running, you can now interact with the server we just built.

grpcurl -plaintext localhost:8080 Inventory/GetBookList

? Note: gRPC defaults to TLS for transport. However, to keep things simple, I will be using the `-plaintext` flag with `grpcurl` so that we can see a human-readable response.

How do we figure out the endpoints of the service? There are two ways to do this. One is by providing a path to the proto files, while the other option enables reflection through the code.

Enabling reflection

This is a pretty cool feature, where it will give you introspection capabilities to your API.


Following screenshot displays some of the commands you can use to introspect the API.

grpcurl -plaintext -msg-template localhost:8080 describe .GetBookListResponse

Using proto files

If you don’t want to to enable it by code we can use the Protobuf files to let gRPCurl know which methods are available. Normally, when a team makes a gRPC service they will make the protobuf files available if you are integrating with them. So, without having to ask them or doing trial-and-error you can use these proto files to introspect what kind of endpoints are available for consumption.

grpcurl -import-path proto -proto bookshop.proto list

gRPCurl is great if you want to debug your RPC calls if you don’t have your client built yet.


In this article we looked at how we can create a simple gRPC server with Go. In the next one we will learn how to do the same with .NET.

Feel free to let me know any feedback or questions. Thanks for reading ✌️


Flatlogic Admin Templates banner