When Servicestack meet F# via Side Waffle
Learn how to integrate Servicestack with F# using Side Waffle templates. Discover practical solutions and avoid common pitfalls.
I have a specific love for Servicestack and that is a known thing. It is not because it is awesome or the way it does web service things that no one else is doing. But because of my past with WCF. It was so rocky that I never want to go back. And moreover, Servicestack does a hell lot of things under the cover, and that is also without doing any damn thing into XML.
Hell, yes.. No XML...
Ok, I could write on and on about Servicestack but for now it is not the topic. The topic is about Shaving the Yak. There are many haters of Visual Studio and its project file. I also don't mind sometimes joining the league. But for most cases it is doing many things that we would need to do otherwise.
And I am saying this because I did this while creating templates for Servicestack. My first experience was damn flawless.
I created one sample application and Daniel Mohl did the mojo jojo part. And the template was up and running. But after that he was a little bit busy with day job so I got that task. And the first challenge was to run Servicestack with F#. Console application is pretty easy as I had done it earlier too and deployed it to Heroku. But with ASP.NET it was giving a weird issue. After struggling for two weeks and asking the community on Twitter, I got an answer from StackOverflow. Damn silly mistake. I copy-pasted code from self host and that was spinning up two servers. Once solved, I was so happy.
But the next thing waiting for me is to make a template. I had no idea how to do that. Other than having a link where to give a pull request. At this point Side Waffle came to the rescue. Just a 5-minute video and you are done.
Ok, I did get some hiccups, like I was unable to create a project at first. But then I did hacking, the lamest one. I did a copy-paste of another working project, removed their data, and inserted mine. And it was working. Obviously this was not the best way, but for now it is working. And I am happy for now.
At last, I gave my first pull request to the F# Community project. Yes, yes, yes... It is time for celebration. This could not be possible without a wonderful helping community on GitHub, Twitter, and StackOverflow.
But two things are certain from my experience: Yak Shaving is a pain in the a##, and Side Waffle is flawless in saving it.
I would highly encourage people having .NET Open Source projects to please make templates and provide the boilerplate code. It will be so easy to get started that way. And it will save time from initial setup to getting up and started.
Update: Currently I am putting together V4 templates at my repo. And again facing issues making the ASP.NET version run.
Right now I am waiting for my pull request to get accepted. Once done, do have a look. You will see that F# and Servicestack are made for each other. Both are strongly typed, believe in message-driven design, and have an async model of working.
In the current state where everyone is making APIs, this is the most viable option for .NET people to have.
Template is currently having V3.71, and it is still under MIT.
Even if someone likes to move to V4, that is also not that costly option for the worth Servicestack brings to development. Once I get up and running with V4, I will put the template for that too.
Community members, if there are any suggestions or comments, please do provide. And obviously I am happy to take pull requests for my template projects too. Different combinations of Servicestack options would be great. Also, if someone can check out the issues, that would be great too.
Update2: Latest template is up at Visual Studio Gallery, now having ASP.NET host too. There are three additional templates. And the V4 issue is solved and the project is working now.
Thanks F#, Servicestack, and specially Side Waffle.
Frequently Asked Questions
Servicestack is a web service framework that handles complex operations without requiring XML configuration, unlike WCF which has a notoriously rocky implementation history. It automates many backend processes that developers would otherwise need to manually configure, making it a more developer-friendly alternative for building web services.
The author accidentally copy-pasted self-host code into the ASP.NET project, which caused two servers to spin up simultaneously and created unexpected errors. After discovering this silly mistake through StackOverflow community help, the issue was quickly resolved.
Side Waffle provides a simple 5-minute video tutorial that walks developers through the template creation process for .NET projects. It significantly reduces the complexity of setting up boilerplate code and project templates, saving time and effort in the development process.
Project templates with boilerplate code make it much easier for new developers to get started with a framework without struggling through setup complexities. This lowers the barrier to entry and encourages more developers to adopt and contribute to open source projects.
Yak shaving refers to the frustrating cycle of getting distracted by minor technical problems while trying to accomplish a larger task. In this article, it represents the time spent solving configuration issues and learning template creation before being able to complete the actual project goal.